Merging Smart-seq2 and 10X Datasets
We have quality-controlled the 10X data and the SS2 data and now are left with the following objects:
10X 5K data - pb_sex_filtered
10X 30K data - pb_30k_sex_filtered
SS2 mutant data - ss2_mutants_final
[1] "patchwork is loaded correctly"
[1] "viridis is loaded correctly"
[1] "Seurat is loaded correctly"
Loading required package: cowplot
Attaching package: ‘cowplot’
The following object is masked from ‘package:patchwork’:
align_plots
[1] "cowplot is loaded correctly"
Loading required package: gridExtra
[1] "gridExtra is loaded correctly"
Loading required package: grid
[1] "grid is loaded correctly"
Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2
Attaching package: ‘Hmisc’
The following object is masked from ‘package:Seurat’:
Key
The following objects are masked from ‘package:base’:
format.pval, units
[1] "Hmisc is loaded correctly"
Loading required package: reshape2
[1] "reshape2 is loaded correctly"
Loading required package: dplyr
Attaching package: ‘dplyr’
The following objects are masked from ‘package:Hmisc’:
src, summarize
The following object is masked from ‘package:gridExtra’:
combine
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
[1] "dplyr is loaded correctly"
Loading required package: Nebulosa
[1] "Nebulosa is loaded correctly"
screen hits
## EDIT - change this to the excel table once we have it finalized for the screen
screen_hits <- c("PBANKA-0516300",
"PBANKA-1217700",
"PBANKA-0409100",
"PBANKA-1034300",
"PBANKA-1437500",
"PBANKA-0827500",
"PBANKA-0824300",
"PBANKA-1426900",
"PBANKA-0105300",
"PBANKA-0921100",
"PBANKA-1002400",
"PBANKA-0829400",
"PBANKA-1347200",
"PBANKA-0828000",
"PBANKA-0902300",
"PBANKA-1418100",
"PBANKA-1435200",
"PBANKA-1454800",
"PBANKA-0712300",
"PBANKA-0410500",
"PBANKA-1144800",
"PBANKA-1231600",
"PBANKA-0503200",
"PBANKA-0308900",
"PBANKA-1214700",
"PBANKA-0709900",
"PBANKA-0311900",
"PBANKA-0716500",
"PBANKA-1447900",
"PBANKA-0102200",
"PBANKA-0713500",
"PBANKA-0102400",
"PBANKA-1302700",
"PBANKA-1235900",
"PBANKA-0401100",
"PBANKA-0413400",
"PBANKA-1126900",
"PBANKA-1425900",
"PBANKA-0418300",
"PBANKA-1464600",
"PBANKA-0806000")
load in datasets
## load the 10X dataset
pb_sex_filtered <- readRDS("../data_to_export/pb_sex_filtered.RDS")
## load the SS2 dataset
ss2_mutants_final <- readRDS("../data_to_export/ss2_mutants_final.RDS")
## inspect
paste("10x dataset")
[1] "10x dataset"
pb_sex_filtered
An object of class Seurat
5098 features across 6191 samples within 1 assay
Active assay: RNA (5098 features, 2000 variable features)
2 dimensional reductions calculated: pca, umap
paste("Smart-seq2 dataset")
[1] "Smart-seq2 dataset"
ss2_mutants_final
An object of class Seurat
5245 features across 2717 samples within 1 assay
Active assay: RNA (5245 features, 2000 variable features)
2 dimensional reductions calculated: pca, umap
paste("The composition of the Smart-seq2 dataset is:")
[1] "The composition of the Smart-seq2 dataset is:"
table(ss2_mutants_final@meta.data$genotype)
Mutant WT
2028 689
## extract 10x data
tenx_5k_counts <- as.matrix(pb_sex_filtered@assays$RNA@counts)
tenx_5k_pheno <- pb_sex_filtered@meta.data
## Create fresh object
tenx_5k_counts_to_integrate <- CreateSeuratObject(counts = tenx_5k_counts, meta.data = tenx_5k_pheno, min.cells = 0, min.features = 0, project = "GCSKO")
Invalid name supplied, making object name syntactically valid. New object name is orig.identnCount_RNAnFeature_RNAexperimentRNA_snn_res.1seurat_clusterspANN_0.25_0.01_440DF.classifications_0.25_0.01_440Prediction.Spearman.r.Spearman.Prediction.Pearsons.r.Pearsons.Prediction.Spearman._Kasiar.Spearman._KasiaPrediction.Pearson._Kasiar.Pearson._KasiaRNA_snn_res.2RNA_snn_res.3; see ?make.names for more details on syntax validity
## add experiment meta data
tenx_5k_counts_to_integrate@meta.data$experiment <- "tenx_5k"
## inspect
tenx_5k_counts_to_integrate
An object of class Seurat
5098 features across 6191 samples within 1 assay
Active assay: RNA (5098 features, 0 variable features)
We need to make sure the mutant data is compatible with the 10X data. the 10X data has fewer genes represented so we need to find the intersect of the two before integration.
## extract SS2 data
mutant_counts_for_integration <- as.matrix(ss2_mutants_final@assays$RNA@counts)
mutant_pheno_for_integration <- ss2_mutants_final@meta.data
## change counts so the :rRNA and :tRNA are not there:
rownames(mutant_counts_for_integration) <- gsub(":ncRNA", "", gsub(":rRNA", "", gsub(":tRNA", "", rownames(mutant_counts_for_integration))))
## change the gene names so that they are - rather than _:
rownames(mutant_counts_for_integration) <- gsub("_", "-", rownames(mutant_counts_for_integration))
## calculate how many of the genes overlap - 10x does start out with 5098 vs 5245
genes_in_tenx_dataset <- intersect(rownames(tenx_5k_counts), rownames(mutant_counts_for_integration))
## print number of genes that overlap
dim(mutant_counts_for_integration)
[1] 5245 2717
## subset the mutant counts to contain only 10x genes
mutant_counts_for_integration <- mutant_counts_for_integration[which(rownames(mutant_counts_for_integration) %in% genes_in_tenx_dataset), ]
## print result of genes that overlap
dim(mutant_counts_for_integration)
[1] 5018 2717
## make Seurat object:
GCSKO_mutants <- CreateSeuratObject(counts = mutant_counts_for_integration, meta.data = mutant_pheno_for_integration, min.cells = 0, min.features = 0, project = "GCSKO")
## add experiment meta data
GCSKO_mutants@meta.data$experiment <- "mutants"
## inspect
GCSKO_mutants
An object of class Seurat
5018 features across 2717 samples within 1 assay
Active assay: RNA (5018 features, 0 variable features)
## double check that this is the same number of genes
## subset counts so that only genes represented in the other two objects are there:
length(intersect(rownames(tenx_5k_counts), rownames(mutant_counts_for_integration)))
[1] 5018
create list and normalise:
## make list
tenx.mutant.list <- list(tenx_5k_counts_to_integrate, GCSKO_mutants)
## prepare data
for (i in 1:length(tenx.mutant.list)) {
tenx.mutant.list[[i]] <- NormalizeData(tenx.mutant.list[[i]], verbose = FALSE)
tenx.mutant.list[[i]] <- FindVariableFeatures(tenx.mutant.list[[i]], selection.method = "vst",
nfeatures = 2000, verbose = FALSE)
}
## Find anchors
tenx.mutant.anchors <- FindIntegrationAnchors(object.list = tenx.mutant.list, dims = 1:21, verbose = FALSE)
UNRELIABLE VALUE: Future (‘future_lapply-1’) unexpectedly generated random numbers without specifying argument '[future.]seed'. There is a risk that those random numbers are not statistically sound and the overall results might be invalid. To fix this, specify argument '[future.]seed', e.g. 'seed=TRUE'. This ensures that proper, parallel-safe random numbers are produced via the L'Ecuyer-CMRG method. To disable this check, use [future].seed=NULL, or set option 'future.rng.onMisuse' to "ignore".
## Integrate data
tenx.mutant.integrated <- IntegrateData(anchorset = tenx.mutant.anchors, dims = 1:21, verbose = FALSE, features.to.integrate = genes_in_tenx_dataset)
Adding a command log without an assay associated with it
## Make the default assay integrated
DefaultAssay(tenx.mutant.integrated) <- "integrated"
## Run the standard workflow for visualization and clustering
tenx.mutant.integrated <- ScaleData(tenx.mutant.integrated, verbose = FALSE)
tenx.mutant.integrated <- RunPCA(tenx.mutant.integrated, npcs = 30, verbose = FALSE)
## inspect PCs
ElbowPlot(tenx.mutant.integrated, ndims = 30, reduction = "pca")
Run inital UMAP
## Run UMAP
tenx.mutant.integrated <- RunUMAP(tenx.mutant.integrated, reduction = "pca", dims = 1:8, n.neighbors = 50, seed.use = 1234, min.dist = 0.5, repulsion.strength = 0.05)
The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric
To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation'
This message will be shown once per session23:37:23 UMAP embedding parameters a = 0.583 b = 1.334
23:37:23 Read 8908 rows and found 8 numeric columns
23:37:23 Using Annoy for neighbor search, n_neighbors = 50
23:37:23 Building Annoy index with metric = cosine, n_trees = 50
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
23:37:25 Writing NN index file to temp file /var/folders/7t/kvh8b3952x9_4b3r74r1kstc000glh/T//RtmpkxWyey/filed4b463f0bca
23:37:26 Searching Annoy index using 1 thread, search_k = 5000
23:37:32 Annoy recall = 100%
23:37:32 Commencing smooth kNN distance calibration using 1 thread
23:37:35 Initializing from normalized Laplacian + noise
23:37:36 Commencing optimization for 500 epochs, with 583548 positive edges
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
23:37:53 Optimization finished
See distribution by: altogether, experiment, and mutant ID
## Plot
DimPlot(tenx.mutant.integrated, reduction = "umap", pt.size = 0.01)
DimPlot(tenx.mutant.integrated, reduction = "umap", split.by = "experiment", pt.size = 0.01)
DimPlot(tenx.mutant.integrated, reduction = "umap", group.by = "identity_updated", label = TRUE, repel = TRUE, pt.size = 0.01)
Using `as.character()` on a quosure is deprecated as of rlang 0.3.0.
Please use `as_label()` or `as_name()` instead.
This warning is displayed once per session.
After optimisation, the following UMAP can be calculated:
## Run optimised UMAP
tenx.mutant.integrated <- RunUMAP(tenx.mutant.integrated, reduction = "pca", dims = 1:10, n.neighbors = 150, seed.use = 1234, min.dist = 0.4, repulsion.strength = 0.03, local.connectivity = 150)
23:43:26 UMAP embedding parameters a = 0.7669 b = 1.223
23:43:26 Read 8908 rows and found 10 numeric columns
23:43:26 Using Annoy for neighbor search, n_neighbors = 150
23:43:26 Building Annoy index with metric = cosine, n_trees = 50
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
23:43:28 Writing NN index file to temp file /var/folders/7t/kvh8b3952x9_4b3r74r1kstc000glh/T//RtmpkxWyey/filed4b551f1ecd
23:43:28 Searching Annoy index using 1 thread, search_k = 15000
23:43:41 Annoy recall = 100%
23:43:42 Commencing smooth kNN distance calibration using 1 thread
23:43:42 8908 smooth knn distance failures
23:43:45 Initializing from normalized Laplacian + noise
23:43:46 Commencing optimization for 500 epochs, with 1813006 positive edges
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
23:48:35 Optimization finished
## plot
dp1 <- DimPlot(tenx.mutant.integrated, label = TRUE, repel = FALSE, pt.size = 0.05, dims = c(2,1), group.by = "experiment") +
## fix the axis
coord_fixed() +
## reverse the scale
#scale_x_reverse() +
scale_y_reverse()
## view
dp1
Now store these reversed embeddings in a new slot
## extract the cell embeddings from the UMAP
mds <- as.data.frame(tenx.mutant.integrated@reductions$umap@cell.embeddings)
## change the coordinates of UMAP 1 so they are reversed
mds$UMAP_1 <- -mds$UMAP_1
## change names of the cols
colnames(mds) <- paste0("DIM_UMAP_", 1:2)
## make into a matrix so that it can be saved in Seurat
mds <- as.matrix(mds)
## store this optimsed UMAP in a custom dim slot
tenx.mutant.integrated[["DIM_UMAP"]] <- CreateDimReducObject(embeddings = mds, key = "DIM_UMAP_", assay = DefaultAssay(tenx.mutant.integrated))
Keys should be one or more alphanumeric characters followed by an underscore, setting key from DIM_UMAP_ to DIMUMAP_All keys should be one or more alphanumeric characters followed by an underscore '_', setting key to DIMUMAP_
## check
DimPlot(tenx.mutant.integrated, label = TRUE, repel = FALSE, pt.size = 0.05, dims = c(2,1), reduction = "DIM_UMAP") + coord_fixed()
Recluster dataset now that it is integrated. We will cluster with a number of resolutions to begin with to see how this affects the number and nature of the clusters.
## copy old clusters
tenx.mutant.integrated <- AddMetaData(tenx.mutant.integrated, tenx.mutant.integrated@meta.data$RNA_snn_res.1, col.name = "pre_integration_clusters")
## generate new clusters at low resolution
## 1
tenx.mutant.integrated <- FindNeighbors(tenx.mutant.integrated, dims = 1:15)
Computing nearest neighbor graph
Computing SNN
tenx.mutant.integrated <- FindClusters(tenx.mutant.integrated, resolution = 1, random.seed = 42, algorithm = 2)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 8908
Number of edges: 319840
Running Louvain algorithm with multilevel refinement...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.8616
Number of communities: 21
Elapsed time: 1 seconds
## generate new clusters at low resolution
## 1.2
tenx.mutant.integrated <- FindNeighbors(tenx.mutant.integrated, dims = 1:15)
Computing nearest neighbor graph
Computing SNN
tenx.mutant.integrated <- FindClusters(tenx.mutant.integrated, resolution = 1.2, random.seed = 42, algorithm = 2)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 8908
Number of edges: 319840
Running Louvain algorithm with multilevel refinement...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.8494
Number of communities: 22
Elapsed time: 1 seconds
## generate new clusters at low resolution
## 1.5
tenx.mutant.integrated <- FindNeighbors(tenx.mutant.integrated, dims = 1:15)
Computing nearest neighbor graph
Computing SNN
tenx.mutant.integrated <- FindClusters(tenx.mutant.integrated, resolution = 1.5, random.seed = 42, algorithm = 2)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 8908
Number of edges: 319840
Running Louvain algorithm with multilevel refinement...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.8315
Number of communities: 24
Elapsed time: 1 seconds
## generate new clusters at mid resolution
## 2
tenx.mutant.integrated <- FindNeighbors(tenx.mutant.integrated, dims = 1:15)
Computing nearest neighbor graph
Computing SNN
tenx.mutant.integrated <- FindClusters(tenx.mutant.integrated, resolution = 2, random.seed = 42, algorithm = 2)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 8908
Number of edges: 319840
Running Louvain algorithm with multilevel refinement...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.8052
Number of communities: 29
Elapsed time: 1 seconds
## generate new clusters at high resolution
## 4
tenx.mutant.integrated <- FindNeighbors(tenx.mutant.integrated, dims = 1:15)
Computing nearest neighbor graph
Computing SNN
tenx.mutant.integrated <- FindClusters(tenx.mutant.integrated, resolution = 4, random.seed = 42, algorithm = 2)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 8908
Number of edges: 319840
Running Louvain algorithm with multilevel refinement...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.7355
Number of communities: 46
Elapsed time: 2 seconds
## print identities
#head(Idents(tenx.mutant.integrated), 10)
View
## Plot
DimPlot(tenx.mutant.integrated, label = TRUE, repel = TRUE, pt.size = 0.05, dims = c(2,1), reduction = "DIM_UMAP", group.by = "integrated_snn_res.1") + coord_fixed()
Make individual plots highlighting where cells in each cluster fall
plot
## this function writes the next bit of code for you
## put it into the console and paste the response
#ploty <- c()
#for(i in seq_along(levels(tenx.mutant.integrated@meta.data$seurat_clusters))){
# ploty <- paste0(ploty, "list_UMAPs_by_cluster[[", i, "]]", " + ")
#}
## plot
list_UMAPs_by_cluster[[1]] + list_UMAPs_by_cluster[[2]] + list_UMAPs_by_cluster[[3]] + list_UMAPs_by_cluster[[4]] + list_UMAPs_by_cluster[[5]] + list_UMAPs_by_cluster[[6]] + list_UMAPs_by_cluster[[7]] + list_UMAPs_by_cluster[[8]] + list_UMAPs_by_cluster[[9]] + list_UMAPs_by_cluster[[10]] + list_UMAPs_by_cluster[[11]] + list_UMAPs_by_cluster[[12]] + list_UMAPs_by_cluster[[13]] + list_UMAPs_by_cluster[[14]] + list_UMAPs_by_cluster[[15]] + list_UMAPs_by_cluster[[16]] + list_UMAPs_by_cluster[[17]] + list_UMAPs_by_cluster[[18]] + list_UMAPs_by_cluster[[19]] + list_UMAPs_by_cluster[[20]]
View
## Plot
DimPlot(tenx.mutant.integrated, label = TRUE, repel = TRUE, pt.size = 0.05, dims = c(2,1), reduction = "DIM_UMAP", group.by = "integrated_snn_res.1.2") + coord_fixed()
Make individual plots highlighting where cells in each cluster fall
[1] 22
plot
## this function writes the next bit of code for you
## put it into the console and paste the response
#ploty <- c()
#for(i in seq_along(levels(tenx.mutant.integrated@meta.data$seurat_clusters))){
# ploty <- paste0(ploty, "list_UMAPs_by_cluster[[", i, "]]", " + ")
#}
## plot
list_UMAPs_by_cluster[[1]] + list_UMAPs_by_cluster[[2]] + list_UMAPs_by_cluster[[3]] + list_UMAPs_by_cluster[[4]] + list_UMAPs_by_cluster[[5]] + list_UMAPs_by_cluster[[6]] + list_UMAPs_by_cluster[[7]] + list_UMAPs_by_cluster[[8]] + list_UMAPs_by_cluster[[9]] + list_UMAPs_by_cluster[[10]] + list_UMAPs_by_cluster[[11]] + list_UMAPs_by_cluster[[12]] + list_UMAPs_by_cluster[[13]] + list_UMAPs_by_cluster[[14]] + list_UMAPs_by_cluster[[15]] + list_UMAPs_by_cluster[[16]] + list_UMAPs_by_cluster[[17]] + list_UMAPs_by_cluster[[18]] + list_UMAPs_by_cluster[[19]] + list_UMAPs_by_cluster[[20]] + list_UMAPs_by_cluster[[21]] + list_UMAPs_by_cluster[[22]]
## Plot
DimPlot(tenx.mutant.integrated, label = TRUE, repel = TRUE, pt.size = 0.05, dims = c(2,1), reduction = "DIM_UMAP", group.by = "integrated_snn_res.1.5") + coord_fixed()
Make individual plots highlighting where cells in each cluster fall
[1] 24
## 1.5 resolution
list_UMAPs_by_cluster[[1]] + list_UMAPs_by_cluster[[2]] + list_UMAPs_by_cluster[[3]] + list_UMAPs_by_cluster[[4]] + list_UMAPs_by_cluster[[5]] + list_UMAPs_by_cluster[[6]] + list_UMAPs_by_cluster[[7]] + list_UMAPs_by_cluster[[8]] + list_UMAPs_by_cluster[[9]] + list_UMAPs_by_cluster[[10]] + list_UMAPs_by_cluster[[11]] + list_UMAPs_by_cluster[[12]] + list_UMAPs_by_cluster[[13]] + list_UMAPs_by_cluster[[14]] + list_UMAPs_by_cluster[[15]] + list_UMAPs_by_cluster[[16]] + list_UMAPs_by_cluster[[17]] + list_UMAPs_by_cluster[[18]] + list_UMAPs_by_cluster[[19]] + list_UMAPs_by_cluster[[20]] + list_UMAPs_by_cluster[[21]] + list_UMAPs_by_cluster[[22]] + list_UMAPs_by_cluster[[23]] + list_UMAPs_by_cluster[[24]] #+ list_UMAPs_by_cluster[[25]]
View
## Plot
DimPlot(tenx.mutant.integrated, label = TRUE, repel = TRUE, pt.size = 0.05, dims = c(2,1), reduction = "DIM_UMAP", group.by = "integrated_snn_res.2") + coord_fixed()
Make individual plots highlighting where cells in each cluster fall
[1] 29
plot
## this function writes the next bit of code for you
## put it into the console and paste the response
#ploty <- c()
#for(i in seq_along(levels(tenx.mutant.integrated@meta.data$seurat_clusters))){
# ploty <- paste0(ploty, "list_UMAPs_by_cluster[[", i, "]]", " + ")
#}
## plot
list_UMAPs_by_cluster[[1]] + list_UMAPs_by_cluster[[2]] + list_UMAPs_by_cluster[[3]] + list_UMAPs_by_cluster[[4]] + list_UMAPs_by_cluster[[5]] + list_UMAPs_by_cluster[[6]] + list_UMAPs_by_cluster[[7]] + list_UMAPs_by_cluster[[8]] + list_UMAPs_by_cluster[[9]] + list_UMAPs_by_cluster[[10]] + list_UMAPs_by_cluster[[11]] + list_UMAPs_by_cluster[[12]] + list_UMAPs_by_cluster[[13]] + list_UMAPs_by_cluster[[14]] + list_UMAPs_by_cluster[[15]] + list_UMAPs_by_cluster[[16]] + list_UMAPs_by_cluster[[17]] + list_UMAPs_by_cluster[[18]] + list_UMAPs_by_cluster[[19]] + list_UMAPs_by_cluster[[20]] + list_UMAPs_by_cluster[[21]] + list_UMAPs_by_cluster[[22]] + list_UMAPs_by_cluster[[23]] + list_UMAPs_by_cluster[[24]] + list_UMAPs_by_cluster[[25]] + list_UMAPs_by_cluster[[26]] + list_UMAPs_by_cluster[[27]] + list_UMAPs_by_cluster[[28]] + list_UMAPs_by_cluster[[29]]# + list_UMAPs_by_cluster[[30]] + list_UMAPs_by_cluster[[31]]
8 vs 11 on resolution 2 already looks pretty cool:
early.sex.de.markers.screen.hits <- early.sex.de.markers[rownames(early.sex.de.markers) %in% c(screen_hits,"PBANKA-1437500"), ]
early.sex.de.markers.screen.hits
look at them across the dataset
DotPlot(tenx.mutant.integrated, features = rownames(early.sex.de.markers[1:10,])) + RotatedAxis()
DotPlot(tenx.mutant.integrated, features = screen_hits) + RotatedAxis()
```r
## find all markers
#all.markers <- FindAllMarkers(tenx.mutant.integrated, only.pos = FALSE, min.pct = 0.25, logfc.threshold = 0.25)
<!-- rnb-source-end -->
<!-- rnb-chunk-end -->
<!-- rnb-text-begin -->
<!-- rnb-text-end -->
<!-- rnb-chunk-begin -->
<!-- rnb-source-begin eyJkYXRhIjoiYGBgclxuYGBgclxuI3RvcF90d28gPC0gYWxsLm1hcmtlcnMgJT4lIGdyb3VwX2J5KGNsdXN0ZXIpICU+JSB0b3BfbihuID0gMiwgd3QgPSBhdmdfbG9nRkMpXG50b3BfdHdvXG5gYGBcbmBgYCJ9 -->
```r
```r
#top_two <- all.markers %>% group_by(cluster) %>% top_n(n = 2, wt = avg_logFC)
top_two
<!-- rnb-source-end -->
<!-- rnb-frame-begin eyJtZXRhZGF0YSI6eyJjbGFzc2VzIjpbImdyb3VwZWRfZGYiLCJ0YmxfZGYiLCJ0YmwiLCJkYXRhLmZyYW1lIl0sIm5yb3ciOjYyLCJuY29sIjo3fSwicmRmIjoiSDRzSUFBQUFBQUFBQTZWV0N6aVUyUnNmdzJDSVZMb2hoTkRGTk4vM3pWVnh2bXpZc2tRWHFlMUNRbW9hZGhxNjdVNjZhYmNidXlWdFc5dUt0dndycWExYy9tMGJRbUdKdEpHVk80V00wRVdGL1dhYzczdithNzU5bm4yZS96elBiK1k5NTd6bnZmemVkODQ1aStjSFlBWUJCZ3dHUTV1aHcyQXl0Rm1FeUdBdFcrcmhKR0l3ZEpqRVFJdFlZS3QrdHhGSzR3aEJqNEF4QVZjMEphNnBoTVdLdzN4NDFsa3Q0enl4K205M0sxN05tdzBjNi9vOEFnUW5YWk84dWx2YnFxYTROdW11Mk4zSzkzYTY4OFhZRkorenptSit5cHAweHc0cFk4VEhMdi9zODVLZDQweWR0czQ4bWc1TzNwLzdzRG0ydDNadHZXdDkrNXNDKy9nblZnL1RGUjZ4dTNaelRpWitzcWhFRVNWZWN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RFFVTzdJVTUxVVV0blZJeWNqMTBZSFNVaFRRZEZoYXlVUllSNmZVS3ZCY2c3eXZ3UHk2bUdyOTYwTldyOFJUdWdGUzZLMnlFTmtjS2dURmlJTkdiNHIvaGFFWGtTa1BEeENTb1RCVkwwUFdDUFMxSktObURDSmtxckNYdThVdkNGS3VzbUp1TnlHSHlpcXh3NERKcXpGR0g0RWtiTGVzRThXeVNHTHZNRkNwR0hoUkZRd0hVblF1aEF5YzJPQ1JEVTluRWhadUZST2trN01idUhJSStRVVF3YkJFUkp5WnZnaUhQd0xSbzR5V1pNVEFBQT0ifQ== -->
<div data-pagedtable="false">
<script data-pagedtable-source type="application/json">
{"columns":[{"label":["p_val"],"name":[1],"type":["dbl"],"align":["right"]},{"label":["avg_logFC"],"name":[2],"type":["dbl"],"align":["right"]},{"label":["pct.1"],"name":[3],"type":["dbl"],"align":["right"]},{"label":["pct.2"],"name":[4],"type":["dbl"],"align":["right"]},{"label":["p_val_adj"],"name":[5],"type":["dbl"],"align":["right"]},{"label":["cluster"],"name":[6],"type":["fctr"],"align":["left"]},{"label":["gene"],"name":[7],"type":["chr"],"align":["left"]}],"data":[{"1":"9.762426e-65","2":"0.7072563","3":"0.733","4":"0.642","5":"4.898786e-61","6":"0","7":"PBANKA-1460400"},{"1":"1.468419e-61","2":"0.8402586","3":"0.675","4":"0.594","5":"7.368526e-58","6":"0","7":"PBANKA-0513600"},{"1":"8.248424e-59","2":"1.6927167","3":"0.615","4":"0.560","5":"4.139059e-55","6":"1","7":"PBANKA-0722600"},{"1":"1.897798e-04","2":"1.3844914","3":"0.226","4":"0.390","5":"9.523152e-01","6":"1","7":"PBANKA-1100441"},{"1":"5.154802e-07","2":"1.1902989","3":"0.424","4":"0.495","5":"2.586680e-03","6":"2","7":"PBANKA-1300096"},{"1":"9.071733e-06","2":"1.1030014","3":"0.213","4":"0.390","5":"4.552196e-02","6":"2","7":"PBANKA-1100441"},{"1":"2.391058e-88","2":"0.8929368","3":"0.829","4":"0.588","5":"1.199833e-84","6":"3","7":"PBANKA-0513600"},{"1":"4.168111e-33","2":"0.8810800","3":"0.558","4":"0.438","5":"2.091558e-29","6":"3","7":"PBANKA-1340000"},{"1":"0.000000e+00","2":"3.0990291","3":"1.000","4":"0.226","5":"0.000000e+00","6":"4","7":"PBANKA-1134900"},{"1":"0.000000e+00","2":"3.0989255","3":"1.000","4":"0.237","5":"0.000000e+00","6":"4","7":"PBANKA-0612400"},{"1":"1.523284e-131","2":"0.9901608","3":"0.990","4":"0.947","5":"7.643840e-128","6":"5","7":"PBANKA-1365500"},{"1":"1.137444e-89","2":"1.0759957","3":"0.820","4":"0.599","5":"5.707695e-86","6":"5","7":"PBANKA-0205000"},{"1":"9.377323e-16","2":"0.8353267","3":"0.255","4":"0.238","5":"4.705541e-12","6":"6","7":"PBANKA-1210800"},{"1":"8.067049e-06","2":"0.9290438","3":"0.435","4":"0.493","5":"4.048045e-02","6":"6","7":"PBANKA-1300096"},{"1":"1.944929e-155","2":"2.2989991","3":"0.792","4":"0.282","5":"9.759652e-152","6":"7","7":"PBANKA-1145400"},{"1":"3.164573e-84","2":"2.0470165","3":"0.717","4":"0.438","5":"1.587983e-80","6":"7","7":"PBANKA-0316841"},{"1":"9.874232e-33","2":"1.2073429","3":"0.642","4":"0.610","5":"4.954889e-29","6":"8","7":"PBANKA-0205000"},{"1":"4.471963e-05","2":"1.1272720","3":"0.485","4":"0.592","5":"2.244031e-01","6":"8","7":"PBANKA-1400400"},{"1":"3.944118e-66","2":"0.8525313","3":"0.875","4":"0.561","5":"1.979158e-62","6":"9","7":"PBANKA-0713300"},{"1":"9.577262e-60","2":"0.9215102","3":"0.673","4":"0.341","5":"4.805870e-56","6":"9","7":"PBANKA-1404800"},{"1":"2.578290e-189","2":"2.0737069","3":"0.997","4":"0.386","5":"1.293786e-185","6":"10","7":"PBANKA-1400600"},{"1":"3.356077e-160","2":"1.7036326","3":"0.955","4":"0.318","5":"1.684079e-156","6":"10","7":"PBANKA-0830200"},{"1":"1.178092e-245","2":"3.2986891","3":"0.990","4":"0.241","5":"5.911666e-242","6":"11","7":"PBANKA-0600600"},{"1":"1.912799e-227","2":"2.9739558","3":"0.987","4":"0.340","5":"9.598423e-224","6":"11","7":"PBANKA-1352100"},{"1":"2.771196e-88","2":"1.0822815","3":"0.924","4":"0.471","5":"1.390586e-84","6":"12","7":"PBANKA-0416500"},{"1":"6.774047e-88","2":"0.9867484","3":"0.982","4":"0.547","5":"3.399217e-84","6":"12","7":"PBANKA-0932200"},{"1":"4.859687e-227","2":"3.0855794","3":"1.000","4":"0.150","5":"2.438591e-223","6":"13","7":"PBANKA-1449000"},{"1":"4.977193e-212","2":"3.0546702","3":"1.000","4":"0.195","5":"2.497555e-208","6":"13","7":"PBANKA-0925400"},{"1":"2.847783e-47","2":"1.2140616","3":"0.529","4":"0.192","5":"1.429018e-43","6":"14","7":"PBANKA-1435200"},{"1":"1.002469e-14","2":"1.5679050","3":"0.286","4":"0.177","5":"5.030392e-11","6":"14","7":"PBANKA-1302700"},{"1":"3.164028e-122","2":"1.3374112","3":"1.000","4":"0.391","5":"1.587709e-118","6":"15","7":"PBANKA-1400600"},{"1":"7.124430e-103","2":"1.3303451","3":"0.924","4":"0.324","5":"3.575039e-99","6":"15","7":"PBANKA-0830200"},{"1":"3.716335e-181","2":"3.6835976","3":"1.000","4":"0.167","5":"1.864857e-177","6":"16","7":"PBANKA-0519400"},{"1":"2.642881e-176","2":"3.4737883","3":"1.000","4":"0.243","5":"1.326198e-172","6":"16","7":"PBANKA-0305000"},{"1":"4.234600e-177","2":"3.9532147","3":"1.000","4":"0.212","5":"2.124922e-173","6":"17","7":"PBANKA-1443300"},{"1":"1.102283e-160","2":"2.9483516","3":"0.995","4":"0.149","5":"5.531257e-157","6":"17","7":"PBANKA-1349000"},{"1":"3.466609e-04","2":"0.8522241","3":"0.239","4":"0.492","5":"1.000000e+00","6":"18","7":"PBANKA-1425100"},{"1":"2.813103e-03","2":"0.7997286","3":"0.202","4":"0.369","5":"1.000000e+00","6":"18","7":"PBANKA-0909200"},{"1":"3.799104e-27","2":"1.0148262","3":"0.626","4":"0.334","5":"1.906390e-23","6":"19","7":"PBANKA-0830200"},{"1":"5.033803e-21","2":"1.0018441","3":"0.667","4":"0.481","5":"2.525962e-17","6":"19","7":"PBANKA-0416500"},{"1":"2.910233e-91","2":"1.7965369","3":"0.911","4":"0.217","5":"1.460355e-87","6":"20","7":"PBANKA-1359900"},{"1":"2.090070e-67","2":"1.9823780","3":"0.863","4":"0.271","5":"1.048797e-63","6":"20","7":"PBANKA-0102400"},{"1":"1.334863e-86","2":"2.4457605","3":"0.904","4":"0.206","5":"6.698341e-83","6":"21","7":"PBANKA-0514900"},{"1":"1.995969e-85","2":"2.2925591","3":"0.886","4":"0.242","5":"1.001577e-81","6":"21","7":"PBANKA-0106300"},{"1":"6.926078e-151","2":"2.9589213","3":"0.993","4":"0.101","5":"3.475506e-147","6":"22","7":"PBANKA-1427700"},{"1":"8.204223e-127","2":"2.5306467","3":"0.974","4":"0.151","5":"4.116879e-123","6":"22","7":"PBANKA-1340400"},{"1":"2.111975e-137","2":"4.1554695","3":"1.000","4":"0.141","5":"1.059789e-133","6":"23","7":"PBANKA-0619700"},{"1":"7.221948e-135","2":"4.4788102","3":"1.000","4":"0.231","5":"3.623974e-131","6":"23","7":"PBANKA-0523700"},{"1":"2.209798e-120","2":"2.5059486","3":"0.993","4":"0.212","5":"1.108877e-116","6":"24","7":"PBANKA-1009600"},{"1":"4.942981e-118","2":"2.3692735","3":"1.000","4":"0.186","5":"2.480388e-114","6":"24","7":"PBANKA-0515000"},{"1":"1.050249e-119","2":"4.3304056","3":"1.000","4":"0.163","5":"5.270152e-116","6":"25","7":"PBANKA-0832800"},{"1":"5.091008e-118","2":"4.3892430","3":"1.000","4":"0.168","5":"2.554668e-114","6":"25","7":"PBANKA-1002600"},{"1":"2.628731e-114","2":"4.9238225","3":"1.000","4":"0.167","5":"1.319097e-110","6":"26","7":"PBANKA-1332700"},{"1":"6.390925e-105","2":"4.2363658","3":"1.000","4":"0.212","5":"3.206966e-101","6":"26","7":"PBANKA-1240600"},{"1":"3.065786e-124","2":"2.7341522","3":"1.000","4":"0.127","5":"1.538411e-120","6":"27","7":"PBANKA-0704700"},{"1":"2.266391e-100","2":"2.3377005","3":"0.990","4":"0.159","5":"1.137275e-96","6":"27","7":"PBANKA-1038800"},{"1":"2.504972e-37","2":"1.9083211","3":"0.960","4":"0.388","5":"1.256995e-33","6":"28","7":"PBANKA-0821900"},{"1":"5.006174e-32","2":"2.2679896","3":"0.947","4":"0.369","5":"2.512098e-28","6":"28","7":"PBANKA-1218100"},{"1":"3.649281e-51","2":"1.7381514","3":"0.985","4":"0.229","5":"1.831209e-47","6":"29","7":"PBANKA-0522400"},{"1":"5.089260e-51","2":"1.9246095","3":"1.000","4":"0.266","5":"2.553790e-47","6":"29","7":"PBANKA-1224900"},{"1":"8.644595e-49","2":"2.3978834","3":"1.000","4":"0.173","5":"4.337858e-45","6":"30","7":"PBANKA-1332700"},{"1":"1.043878e-33","2":"2.2141084","3":"1.000","4":"0.556","5":"5.238182e-30","6":"30","7":"PBANKA-1101100"}],"options":{"columns":{"min":{},"max":[10],"total":[7]},"rows":{"min":[10],"max":[10],"total":[62]},"pages":{}}}
</script>
</div>
<!-- rnb-frame-end -->
<!-- rnb-chunk-end -->
<!-- rnb-text-begin -->
#### resolution = 4
View
<!-- rnb-text-end -->
<!-- rnb-chunk-begin -->
<!-- rnb-source-begin eyJkYXRhIjoiYGBgclxuIyMgUGxvdFxuRGltUGxvdCh0ZW54Lm11dGFudC5pbnRlZ3JhdGVkLCBsYWJlbCA9IFRSVUUsIHJlcGVsID0gVFJVRSwgcHQuc2l6ZSA9IDAuMDUsIGRpbXMgPSBjKDIsMSksIHJlZHVjdGlvbiA9IFwiRElNX1VNQVBcIiwgZ3JvdXAuYnkgPSBcImludGVncmF0ZWRfc25uX3Jlcy40XCIpICsgY29vcmRfZml4ZWQoKSBcbmBgYCJ9 -->
```r
## Plot
DimPlot(tenx.mutant.integrated, label = TRUE, repel = TRUE, pt.size = 0.05, dims = c(2,1), reduction = "DIM_UMAP", group.by = "integrated_snn_res.4") + coord_fixed()
Make individual plots highlighting where cells in each cluster fall
[1] 46
plot
## this function writes the next bit of code for you
## put it into the console and paste the response
#ploty <- c()
#for(i in seq_along(levels(tenx.mutant.integrated@meta.data$seurat_clusters))){
# ploty <- paste0(ploty, "list_UMAPs_by_cluster[[", i, "]]", " + ")
#}
## plot
list_UMAPs_by_cluster[[1]] + list_UMAPs_by_cluster[[2]] + list_UMAPs_by_cluster[[3]] + list_UMAPs_by_cluster[[4]] + list_UMAPs_by_cluster[[5]] + list_UMAPs_by_cluster[[6]] + list_UMAPs_by_cluster[[7]] + list_UMAPs_by_cluster[[8]] + list_UMAPs_by_cluster[[9]] + list_UMAPs_by_cluster[[10]] + list_UMAPs_by_cluster[[11]] + list_UMAPs_by_cluster[[12]] + list_UMAPs_by_cluster[[13]] + list_UMAPs_by_cluster[[14]] + list_UMAPs_by_cluster[[15]] + list_UMAPs_by_cluster[[16]] + list_UMAPs_by_cluster[[17]] + list_UMAPs_by_cluster[[18]] + list_UMAPs_by_cluster[[19]] + list_UMAPs_by_cluster[[20]] + list_UMAPs_by_cluster[[21]] + list_UMAPs_by_cluster[[22]] + list_UMAPs_by_cluster[[23]] + list_UMAPs_by_cluster[[24]] + list_UMAPs_by_cluster[[25]] + list_UMAPs_by_cluster[[26]] + list_UMAPs_by_cluster[[27]] + list_UMAPs_by_cluster[[28]] + list_UMAPs_by_cluster[[29]] + list_UMAPs_by_cluster[[30]] + list_UMAPs_by_cluster[[31]] + list_UMAPs_by_cluster[[32]] + list_UMAPs_by_cluster[[33]] + list_UMAPs_by_cluster[[34]] + list_UMAPs_by_cluster[[35]] + list_UMAPs_by_cluster[[36]] + list_UMAPs_by_cluster[[37]] + list_UMAPs_by_cluster[[38]] + list_UMAPs_by_cluster[[39]] + list_UMAPs_by_cluster[[40]] + list_UMAPs_by_cluster[[41]] + list_UMAPs_by_cluster[[42]] + list_UMAPs_by_cluster[[43]] + list_UMAPs_by_cluster[[44]] + list_UMAPs_by_cluster[[45]] + list_UMAPs_by_cluster[[46]]
## run a new UMAP with
tenx.mutant.integrated <- RunUMAP(tenx.mutant.integrated, reduction = "pca", dims = 1:10, n.components = 10)
00:34:30 UMAP embedding parameters a = 0.9922 b = 1.112
00:34:30 Read 8908 rows and found 10 numeric columns
00:34:30 Using Annoy for neighbor search, n_neighbors = 30
00:34:30 Building Annoy index with metric = cosine, n_trees = 50
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
00:34:34 Writing NN index file to temp file /var/folders/7t/kvh8b3952x9_4b3r74r1kstc000glh/T//RtmpkxWyey/filed4b4678fa55
00:34:34 Searching Annoy index using 1 thread, search_k = 3000
00:34:37 Annoy recall = 100%
00:36:00 Commencing smooth kNN distance calibration using 1 thread
00:36:05 Initializing from normalized Laplacian + noise
00:36:06 Commencing optimization for 500 epochs, with 366720 positive edges
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
00:36:40 Optimization finished
## generate new clusters at low resolution
tenx.mutant.integrated <- FindNeighbors(tenx.mutant.integrated, dims = 1:10, reduction = "umap")
Computing nearest neighbor graph
Computing SNN
tenx.mutant.integrated <- FindClusters(tenx.mutant.integrated, resolution = 0.5, random.seed = 42, algorithm = 2)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 8908
Number of edges: 214651
Running Louvain algorithm with multilevel refinement...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9475
Number of communities: 26
Elapsed time: 1 seconds
[1] 26
plot
## this function writes the next bit of code for you
## put it into the console and paste the response
#ploty <- c()
#for(i in seq_along(levels(tenx.mutant.integrated@meta.data$seurat_clusters))){
# ploty <- paste0(ploty, "list_UMAPs_by_cluster[[", i, "]]", " + ")
#}
## plot
list_UMAPs_by_cluster[[1]] + list_UMAPs_by_cluster[[2]] + list_UMAPs_by_cluster[[3]] + list_UMAPs_by_cluster[[4]] + list_UMAPs_by_cluster[[5]] + list_UMAPs_by_cluster[[6]] + list_UMAPs_by_cluster[[7]] + list_UMAPs_by_cluster[[8]] + list_UMAPs_by_cluster[[9]] + list_UMAPs_by_cluster[[10]] + list_UMAPs_by_cluster[[11]] + list_UMAPs_by_cluster[[12]] + list_UMAPs_by_cluster[[13]] + list_UMAPs_by_cluster[[14]] + list_UMAPs_by_cluster[[15]] + list_UMAPs_by_cluster[[16]] + list_UMAPs_by_cluster[[17]] + list_UMAPs_by_cluster[[18]] + list_UMAPs_by_cluster[[19]] + list_UMAPs_by_cluster[[20]] + list_UMAPs_by_cluster[[21]] + list_UMAPs_by_cluster[[22]] + list_UMAPs_by_cluster[[23]] + list_UMAPs_by_cluster[[24]] + list_UMAPs_by_cluster[[25]] + list_UMAPs_by_cluster[[26]]
We will look in more detail at cells as they enter the sexual trajecotry later. The PCA clustering will be more appropriate in this high-resolution view. In order to subset these cells, we will use the UMAP clustering.
We will get some high level insight into these clusters now
We have defined clusters, now we will identify what the clusters correspond to. We can use a number of external datasets to do this:
known marker genes
bulk RNA-seq data correlation
## make plots
plots <- FeaturePlot(tenx.mutant.integrated, features = c("PBANKA-1319500", "PBANKA-0416100"), blend = TRUE, combine = FALSE, coord.fixed = TRUE, dims = c(2,1), reduction = "DIM_UMAP")
# Get just the co-expression plot, built-in legend is meaningless for this plot
#plots[[3]] + NoLegend()
# Get just the key
#plots[[4]]
# Stitch the co-expression and key plots together
plots[[3]] + NoLegend() + plots[[4]]/plot_spacer() + plot_layout(widths = c(2,1))
marker genes plots
Mutant cells could have aberant expression so we will use only wild-type cells:
make a metadata column where the 10X data is classified as a WT genotype
## get cells that are filtered out
cells_10x <- which(tenx.mutant.integrated@meta.data$experiment == "tenx_5k")
## make extra column in plotting df
tenx.mutant.integrated@meta.data$genotype_combined <- tenx.mutant.integrated@meta.data$genotype
tenx.mutant.integrated@meta.data$genotype_combined[cells_10x] <- "WT"
## inspect
table(tenx.mutant.integrated@meta.data$genotype_combined)
Mutant WT
2028 6880
wild_type_cells <- rownames(tenx.mutant.integrated@meta.data[tenx.mutant.integrated@meta.data$genotype_combined == "WT", ])
tenx.mutant.integrated.wt <- subset(tenx.mutant.integrated, cells = wild_type_cells)
#FeaturePlot(tenx.mutant.integrated.wt, features = "PBANKA-1101300", coord.fixed = TRUE, min.cutoff = "q1", dims = c(2,1), reduction = "DIM_UMAP", pt.size = 1, order = TRUE)
## Run the standard workflow for visualization and clustering
#tenx.mutant.integrated.wt <- ScaleData(tenx.mutant.integrated.wt, verbose = FALSE)
#tenx.mutant.integrated.wt <- RunPCA(tenx.mutant.integrated.wt, npcs = 30, verbose = FALSE)
## inspect PCs
#ElbowPlot(tenx.mutant.integrated.wt, ndims = 30, reduction = "pca")
## Run optimised UMAP
#tenx.mutant.integrated.wt <- RunUMAP(tenx.mutant.integrated.wt, reduction = "pca", dims = 1:10, n.neighbors = 150, seed.use = 1234, min.dist = 0.4, repulsion.strength = 0.03, local.connectivity = 150)
## plot
#dp1 <- DimPlot(tenx.mutant.integrated.wt, label = TRUE, repel = FALSE, pt.size = 0.05, dims = c(2,1), group.by = "experiment") +
## fix the axis
#coord_fixed() +
## reverse the scale
#scale_y_reverse()
## view
#dp1
plot_density(tenx.mutant.integrated.wt, markers_list, joint = FALSE, dims = c(2,1), pal = "plasma")
Then define each cluster as Male, Female or Asexual:
## copy clusters to new column
tenx.mutant.integrated@meta.data$cluster_colours_figure <- NA
## define which clusters will be which identity
male_clusters <- c("22", "18", "9", "16")
female_clusters <- c("19","24","20","3")
asex_clusters <- c("8","1","0","4","2","6","7","5","12","14","15","10","23","13","17","21","25")
bipotential_clusters <- c("11")
## check length of the unique entries in the manualy created list above and the number of clusters in total
paste("Is the total number of clusters in the list the same as the number of clusters in the slot?", identical(length(unique(c(male_clusters, female_clusters, asex_clusters, bipotential_clusters))), length(levels(tenx.mutant.integrated@meta.data$seurat_clusters))))
[1] "Is the total number of clusters in the list the same as the number of clusters in the slot? TRUE"
## change the column IDs
tenx.mutant.integrated@meta.data$cluster_colours_figure[which(tenx.mutant.integrated@meta.data$seurat_clusters %in% male_clusters)] <- "Male"
tenx.mutant.integrated@meta.data$cluster_colours_figure[which(tenx.mutant.integrated@meta.data$seurat_clusters %in% female_clusters)] <- "Female"
tenx.mutant.integrated@meta.data$cluster_colours_figure[which(tenx.mutant.integrated@meta.data$seurat_clusters %in% asex_clusters)] <- "Asexual"
tenx.mutant.integrated@meta.data$cluster_colours_figure[which(tenx.mutant.integrated@meta.data$seurat_clusters %in% bipotential_clusters)] <- "Bipotential"
table(tenx.mutant.integrated@meta.data$cluster_colours_figure)
Asexual Bipotential Female Male
6934 233 954 787
useful tools for all plots
## define male and female symbol
female_symbol <- intToUtf8(9792)
male_symbol <- intToUtf8(9794)
## make a custom pal
# 1 = blue - "#0052c5"
# 2 = red - "#a52b1e"
# 3 = green - "#016c00"
# 4 = yellow - "#ffe400"
pal_sex <- c("#0052c5","#ffe400", "#a52b1e", "#016c00")
UMAP_identity <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.5, group.by = "cluster_colours_figure", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_colour_manual(values=pal_sex) +
theme_void() +
theme(legend.position = "none")
## print
UMAP_identity
save
ggsave("../images_to_export/merge_UMAP_identity.png", plot = UMAP_identity, device = "png", path = NULL, scale = 1, width = 20, height = 20, units = "cm", dpi = 300, limitsize = TRUE)
save
ggsave("../images_to_export/merge_UMAP_cluster.png", plot = umap_cluster, device = "png", path = NULL, scale = 1, width = 20, height = 20, units = "cm", dpi = 300, limitsize = TRUE)
## make plots
## hoo dataset correlation
UMAP_hoo <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, group.by = "Prediction.Spearman.", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
theme_void() +
labs(title = paste("Hoo Predicted Timepoint")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 20, face = "bold")) +
scale_colour_manual(values = inferno(12)) +
labs(colour = "hour") +
theme(legend.position = "bottom", legend.title=element_text(size=10))
## ap2g timecourse in this paper correlation
UMAP_kasia <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, group.by = "Prediction.Spearman._Kasia", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
theme_void() +
labs(title = paste("AP2G Timecourse Predicted Timepoint")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 20, face = "bold")) +
scale_colour_manual(values = inferno(10)) +
labs(colour = "hour") +
theme(legend.position = "bottom", legend.title=element_text(size=10))
## combine
umap_bulk <- wrap_plots(UMAP_hoo, UMAP_kasia, ncol = 2)
## print
umap_bulk
```r
ggsave(\../images_to_export/merge_umap_bulk_prediction.png\, plot = umap_bulk, device = \png\, path = NULL, scale = 1, width = 30, height = 10, units = \cm\, dpi = 300, limitsize = TRUE)
<!-- rnb-source-end -->
<!-- rnb-chunk-end -->
<!-- rnb-text-begin -->
#### Fig. 3.C. By Experiment
The original method of plotting by experiment does not allow much customisation of the plots. I.e. we cannot easily change the titles of each plot
<!-- rnb-text-end -->
<!-- rnb-chunk-begin -->
<!-- rnb-source-begin eyJkYXRhIjoiYGBgclxuIyMgUGxvdFxuRGltUGxvdCh0ZW54Lm11dGFudC5pbnRlZ3JhdGVkLCBsYWJlbCA9IFRSVUUsIHJlcGVsID0gVFJVRSwgcHQuc2l6ZSA9IDAuNSwgc3BsaXQuYnkgPSBcImV4cGVyaW1lbnRcIiwgZGltcyA9IGMoMiwxKSwgcmVkdWN0aW9uID0gXCJESU1fVU1BUFwiKSArIFxuICBjb29yZF9maXhlZCgpICtcbiAgdGhlbWUobGVnZW5kLnBvc2l0aW9uPVwiYm90dG9tXCIsIGF4aXMubGluZT1lbGVtZW50X2JsYW5rKCksYXhpcy50ZXh0Lng9ZWxlbWVudF9ibGFuaygpLFxuICAgICAgICAgIGF4aXMudGV4dC55PWVsZW1lbnRfYmxhbmsoKSxheGlzLnRpY2tzPWVsZW1lbnRfYmxhbmsoKSxcbiAgICAgICAgICBheGlzLnRpdGxlLng9ZWxlbWVudF9ibGFuaygpLFxuICAgICAgICAgIGF4aXMudGl0bGUueT1lbGVtZW50X2JsYW5rKCkpXG5gYGAifQ== -->
```r
## Plot
DimPlot(tenx.mutant.integrated, label = TRUE, repel = TRUE, pt.size = 0.5, split.by = "experiment", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
theme(legend.position="bottom", axis.line=element_blank(),axis.text.x=element_blank(),
axis.text.y=element_blank(),axis.ticks=element_blank(),
axis.title.x=element_blank(),
axis.title.y=element_blank())
But, we can use the following code to do this
## make an extra meta.data column so you can split the object by SS2 mutant, SS2 WT, 10X
## make new column in meta.data
tenx.mutant.integrated@meta.data$sub_genotype <- tenx.mutant.integrated@meta.data$genotype
## replace NA values from 10X data with a value
tenx.mutant.integrated@meta.data$sub_genotype[is.na(tenx.mutant.integrated@meta.data$sub_genotype)] <- "10X_WT"
## check
table(tenx.mutant.integrated@meta.data$sub_genotype)
10X_WT Mutant WT
6191 2028 689
## split seurat object up
ob.list <- SplitObject(tenx.mutant.integrated, split.by = "sub_genotype")
## make plots for each object
plot.list <- lapply(X = ob.list, FUN = function(x) {
DimPlot(x, dims = c(2,1), reduction = "DIM_UMAP", label = FALSE, label.size = 5, repel = TRUE, pt.size = 1) + theme(legend.position="bottom")
})
## use this function to extract legend:
## source: https://stackoverflow.com/questions/13649473/add-a-common-legend-for-combined-ggplots
## source: https://github.com/hadley/ggplot2/wiki/Share-a-legend-between-two-ggplot2-graphs
g_legend<-function(a.gplot){
tmp <- ggplot_gtable(ggplot_build(a.gplot))
leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
legend <- tmp$grobs[[leg]]
return(legend)}
## make plots pretty
p1 <- plot.list$`10X_WT` + theme_void() + guides(colour=guide_legend(nrow=2,byrow=TRUE, override.aes = list(size=4)))
p2 <- plot.list$WT + theme_void()
p3 <- plot.list$Mutant + theme_void()
## get legend
mylegend<-g_legend(p1)
## make a final plot
p4 <- grid.arrange(arrangeGrob(p1 + theme(legend.position="none") + labs(title = paste("10X", "\n", "(wild-type)")) + theme(plot.title = element_text(hjust = 0.5)),
p2 + theme(legend.position="none") + labs(title = paste("Smart-seq2", "\n", "(wild-type)")) + theme(plot.title = element_text(hjust = 0.5)),
p3 + theme(legend.position="none") + labs(title = paste("Smart-seq2", "\n", "(mutant)")) + theme(plot.title = element_text(hjust = 0.5)), nrow=1),
mylegend, nrow=2,heights=c(10, 1))
Make final plots:
p1 <- plot.list$`10X_WT` +
coord_fixed() +
theme_void() +
scale_color_manual(values=c(replicate(45, "#999999"))) +
labs(title = paste("10X (wild-type)")) +
theme(legend.position = "none", plot.title = element_text(hjust = 0.5, family="Arial", size = 20, face = "bold"))
p2 <- plot.list$WT +
coord_fixed() +
theme_void() +
scale_color_manual(values=c(replicate(46, "#999999"))) +
labs(title = paste("Smart-seq2 (wild-type)")) +
theme(legend.position = "none", plot.title = element_text(hjust = 0.5, family="Arial", size = 20, face = "bold"))
p3 <- plot.list$Mutant +
coord_fixed() +
theme_void() +
scale_color_manual(values=c(replicate(46, "#999999"))) +
labs(title = paste("Smart-seq2 (mutant)")) +
theme(legend.position = "none", plot.title = element_text(hjust = 0.5, family="Arial", size = 20, face = "bold"))
p1 + p2 + p3
## make composite plot
UMAP_composite <- wrap_plots(marker_gene_plot_FAMB , marker_gene_plot_MSP8 , marker_gene_plot_MSP1 , marker_gene_plot_AP2G , marker_gene_plot_CCP2 , marker_gene_plot_MG1 , p1 , p2 , p3, ncol = 3)
## print
UMAP_composite
save
```r
ggsave(\../images_to_export/merge_umap_technology_and_markers.png\, plot = UMAP_composite, device = \png\, path = NULL, scale = 1, width = 30, height = 30, units = \cm\, dpi = 300, limitsize = TRUE)
<!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pdHlfcGxvdHNbWzJdXSArIGNvb3JkX2ZpeGVkKCkgKyB0aGVtZV92b2lkKCkgKyBsYWJzKHRpdGxlID0gcGFzdGUoXCJNRzEgKE1hbGUpXCIpKSArIHNjYWxlX2NvbG91cl9ncmFkaWVudG4oY29sb3Vycz1jKFwiI0RDRENEQ1wiLCBwbGFzbWEoMzApKSkgKyBndWlkZXMoY29sb3VyID0gZ3VpZGVfY29sb3VyYmFyKGJhcndpZHRoID0gMC41LCB0aXRsZSA9IFwiXCIpKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcDEgLCBcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcDIgLCBcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcDMsIFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuY29sID0gMylcbmBgYCJ9 -->
```r
# PBANKA-1319500 - CCP2 - female - used in 820 line
# PBANKA-0416100 - MG1 - dynenin heavy chain - male - used in 820 line
# PBANKA-1437500 - AP2G - commitment
# PBANKA-0831000 - MSP1 - late asexual
# PBANKA-1102200 - MSP8 - early asexual (from Bozdech paper)
# PBANKA-0711900 - HSP70 - promoter used for GFP and RFP expression in the mutants
# PBANKA-1400400 - FAMB - ring marker - discovered by looking for marker genes in data
# PBANKA-0722600 - Fam-b2 - ring marker - https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5113031/
# theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 20, face = "bold")) +
markers_list <- c("PBANKA-1319500", "PBANKA-0416100", "PBANKA-1437500", "PBANKA-0831000", "PBANKA-1102200", "PBANKA-0711900", "PBANKA-1400400", "PBANKA-0722600")
list_of_density_plots <- plot_density(tenx.mutant.integrated.wt, markers_list, joint = FALSE, combine = FALSE, dims = c(2,1), pal = "plasma", method = "ks")
## make composite plot
UMAP_composite <- wrap_plots(list_of_density_plots[[8]] + coord_fixed() + theme_void() + labs(title = paste("Fam-b2 (Ring)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots[[5]] + coord_fixed() + theme_void() + labs(title = paste("MSP8 (Asexual)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots[[4]] + coord_fixed() + theme_void() + labs(title = paste("MSP1 (Schizont)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots[[3]] + coord_fixed() + theme_void() + labs(title = paste("AP2G (Commitment)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30)) )+ guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots[[1]] + coord_fixed() + theme_void() +
labs(title = paste("CCP2 (Female)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots[[2]] + coord_fixed() + theme_void() + labs(title = paste("MG1 (Male)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
p1 ,
p2 ,
p3,
ncol = 3)
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
UMAP_composite
Specific gene expression of mutants
save
```r
ggsave(\../images_to_export/merge_umap_mutant_gene_expression.png\, plot = mutant_expression_composite, device = \png\, path = NULL, scale = 1, width = 30, height = 30, units = \cm\, dpi = 300, limitsize = TRUE)
<!-- rnb-source-end -->
<!-- rnb-chunk-end -->
<!-- rnb-text-begin -->
Density plot version
<!-- rnb-text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XRhbnRfZ2VuZXNbWzEwXV0gKyBjb29yZF9maXhlZCgpICsgdGhlbWVfdm9pZCgpICsgbGFicyh0aXRsZSA9IHBhc3RlKFwiZmQ0XCIpKSArIHNjYWxlX2NvbG91cl9ncmFkaWVudG4oY29sb3Vycz1jKFwiI0RDRENEQ1wiLCBwbGFzbWEoMzApKSkgKyBndWlkZXMoY29sb3VyID0gZ3VpZGVfY29sb3VyYmFyKGJhcndpZHRoID0gMC41LCB0aXRsZSA9IFwiXCIpKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmNvbCA9IDQpXG5gYGAifQ== -->
```r
# PBANKA-0828000 GCSKO-3 GD1
# PBANKA-1302700 GCSKO-oom MD1
# PBANKA-1447900 GCSKO-29 MD2
# PBANKA-0102400 GCSKO-2 MD3
# PBANKA-0716500 GCSKO-19 MD4
# PBANKA-0413400 GCSKO-10_820 MD5
# PBANKA-1454800 GCSKO-21 FD1
# PBANKA-0902300 GCSKO-13 FD2
# PBANKA-1418100 GCSKO-17 FD3
# PBANKA-1435200 GCSKO-20 FD4
markers_list <- c("PBANKA-0828000", "PBANKA-1302700", "PBANKA-1447900", "PBANKA-0102400", "PBANKA-0716500", "PBANKA-0413400", "PBANKA-1454800", "PBANKA-0902300", "PBANKA-1418100", "PBANKA-1435200")
list_of_density_plots_mutant_genes <- plot_density(tenx.mutant.integrated.wt, markers_list, joint = FALSE, combine = FALSE, dims = c(2,1), pal = "plasma", method = "ks")
## make composite plot
UMAP_composite_mutant_genes <- wrap_plots(list_of_density_plots_mutant_genes[[1]] + coord_fixed() + theme_void() + labs(title = paste("gd1")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots_mutant_genes[[2]] + coord_fixed() + theme_void() + labs(title = paste("md1")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots_mutant_genes[[3]] + coord_fixed() + theme_void() + labs(title = paste("md2")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots_mutant_genes[[4]] + coord_fixed() + theme_void() + labs(title = paste("md3")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30)) )+ guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots_mutant_genes[[5]] + coord_fixed() + theme_void() +
labs(title = paste("md4")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots_mutant_genes[[6]] + coord_fixed() + theme_void() + labs(title = paste("md5")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots_mutant_genes[[7]] + coord_fixed() + theme_void() + labs(title = paste("fd1")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots_mutant_genes[[8]] + coord_fixed() + theme_void() + labs(title = paste("fd2")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots_mutant_genes[[9]] + coord_fixed() + theme_void() + labs(title = paste("fd3")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
list_of_density_plots_mutant_genes[[10]] + coord_fixed() + theme_void() + labs(title = paste("fd4")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, title = "")),
ncol = 4)
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
UMAP_composite_mutant_genes
save
ggsave("../images_to_export/merge_umap_mutant_gene_expression.png", plot = UMAP_composite_mutant_genes, device = "png", path = NULL, scale = 1, width = 30, height = 30, units = "cm", dpi = 300, limitsize = TRUE)
All the mutant genotypes profiled were:
## make a list of possible genotypes
unique(tenx.mutant.integrated@meta.data$identity_updated)
[1] NA "GCSKO-oom" "WT" "GCSKO-29" "GCSKO-21" "GCSKO-17" "GCSKO-2"
[8] "GCSKO-19" "GCSKO-20" "GCSKO-13" "GCSKO-10_820" "GCSKO-3"
unique(tenx.mutant.integrated@meta.data$identity_name_updated)
[1] NA "md1" "wild-type" "md2" "fd1" "fd3" "md3" "md4" "fd4"
[10] "fd2" "md5" "gd1"
# PBANKA-0828000 GCSKO-3 GD1
# PBANKA-1302700 GCSKO-oom MD1
# PBANKA-1447900 GCSKO-29 MD2
# PBANKA-0102400 GCSKO-2 MD3
# PBANKA-0716500 GCSKO-19 MD4
# PBANKA-0413400 GCSKO-10_820 MD5
# PBANKA-1454800 GCSKO-21 FD1
# PBANKA-0902300 GCSKO-13 FD2
# PBANKA-1418100 GCSKO-17 FD3
# PBANKA-1435200 GCSKO-20 FD4
## ~ TODO ~ MAKE INTO A FOR LOOP
## make lists for each genotype
cells_17 <- rownames(tenx.mutant.integrated@meta.data[which(tenx.mutant.integrated@meta.data$identity_updated == "GCSKO-17"), ])
cells_2 <- rownames(tenx.mutant.integrated@meta.data[which(tenx.mutant.integrated@meta.data$identity_updated == "GCSKO-2"), ])
cells_19 <- rownames(tenx.mutant.integrated@meta.data[which(tenx.mutant.integrated@meta.data$identity_updated == "GCSKO-19"), ])
cells_20 <- rownames(tenx.mutant.integrated@meta.data[which(tenx.mutant.integrated@meta.data$identity_updated == "GCSKO-20"), ])
cells_13 <- rownames(tenx.mutant.integrated@meta.data[which(tenx.mutant.integrated@meta.data$identity_updated == "GCSKO-13"), ])
cells_10 <- rownames(tenx.mutant.integrated@meta.data[which(tenx.mutant.integrated@meta.data$identity_updated == "GCSKO-10_820"), ])
cells_3 <- rownames(tenx.mutant.integrated@meta.data[which(tenx.mutant.integrated@meta.data$identity_updated == "GCSKO-3"), ])
cells_oom <- rownames(tenx.mutant.integrated@meta.data[which(tenx.mutant.integrated@meta.data$identity_updated == "GCSKO-oom"), ])
cells_29 <- rownames(tenx.mutant.integrated@meta.data[which(tenx.mutant.integrated@meta.data$identity_updated == "GCSKO-29"), ])
cells_21 <- rownames(tenx.mutant.integrated@meta.data[which(tenx.mutant.integrated@meta.data$identity_updated == "GCSKO-21"), ])
## make plots
pm2 <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, cells.highlight = cells_17, group.by = "exclude_for_sex_ratio", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_color_manual(values=c("#000000", "#f54e1e")) +
theme_void() +
labs(title = paste("fd3","\n", "(PBANKA_1418100)")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 15, face = "bold"), legend.position = "none") +
## add sex symbols
annotate("text", x = 3.8, y = 1.5, label = male_symbol, size=7, color="gray") +
annotate("text", x = 2, y = 2.8, label = female_symbol, size=7, color="gray")
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
pm3 <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, cells.highlight = cells_2, group.by = "exclude_for_sex_ratio", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_color_manual(values=c("#000000", "#f54e1e")) +
theme_void() +
labs(title = paste("md3","\n", "(PBANKA_0102400)")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 15, face = "bold"), legend.position = "none") +
## add sex symbols
annotate("text", x = 3.8, y = 1.5, label = male_symbol, size=7, color="gray") +
annotate("text", x = 2, y = 2.8, label = female_symbol, size=7, color="gray")
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
pm4 <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, cells.highlight = cells_19, group.by = "exclude_for_sex_ratio", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_color_manual(values=c("#000000", "#f54e1e")) +
theme_void() +
labs(title = paste("md4","\n", "(PBANKA_0716500)")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 15, face = "bold"), legend.position = "none") +
## add sex symbols
annotate("text", x = 3.8, y = 1.5, label = male_symbol, size=7, color="gray") +
annotate("text", x = 2, y = 2.8, label = female_symbol, size=7, color="gray")
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
pm5 <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, cells.highlight = cells_20, group.by = "exclude_for_sex_ratio", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_color_manual(values=c("#000000", "#f54e1e")) +
theme_void() +
labs(title = paste("fd4","\n", "(PBANKA_1435200)")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 15, face = "bold"), legend.position = "none") +
## add sex symbols
annotate("text", x = 3.8, y = 1.5, label = male_symbol, size=7, color="gray") +
annotate("text", x = 2, y = 2.8, label = female_symbol, size=7, color="gray")
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
pm6 <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, cells.highlight = cells_13, group.by = "exclude_for_sex_ratio", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_color_manual(values=c("#000000", "#f54e1e")) +
theme_void() +
labs(title = paste("fd2","\n", "PBANKA_0902300")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 15, face = "bold"), legend.position = "none") +
## add sex symbols
annotate("text", x = 3.8, y = 1.5, label = male_symbol, size=7, color="gray") +
annotate("text", x = 2, y = 2.8, label = female_symbol, size=7, color="gray")
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
pm7 <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, cells.highlight = cells_10, group.by = "exclude_for_sex_ratio", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_color_manual(values=c("#000000", "#f54e1e")) +
theme_void() +
labs(title = paste("md5","\n", "(PBANKA_0413400)")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 15, face = "bold"), legend.position = "none") +
## add sex symbols
annotate("text", x = 3.8, y = 1.5, label = male_symbol, size=7, color="gray") +
annotate("text", x = 2, y = 2.8, label = female_symbol, size=7, color="gray")
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
pm8 <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, cells.highlight = cells_3, group.by = "exclude_for_sex_ratio", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_color_manual(values=c("#000000", "#f54e1e")) +
theme_void() +
labs(title = paste("gd1","\n", "(PBANKA_0828000)")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 15, face = "bold"), legend.position = "none") +
## add sex symbols
annotate("text", x = 3.8, y = 1.5, label = male_symbol, size=7, color="gray") +
annotate("text", x = 2, y = 2.8, label = female_symbol, size=7, color="gray")
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
pm9 <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, cells.highlight = cells_oom, group.by = "exclude_for_sex_ratio", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_color_manual(values=c("#000000", "#f54e1e")) +
theme_void() +
labs(title = paste("md1","\n", "(PBANKA_1302700)")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 15, face = "bold"), legend.position = "none") +
## add sex symbols
annotate("text", x = 3.8, y = 1.5, label = male_symbol, size=7, color="gray") +
annotate("text", x = 2, y = 2.8, label = female_symbol, size=7, color="gray")
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
pm10 <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, cells.highlight = cells_29, group.by = "exclude_for_sex_ratio", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_color_manual(values=c("#000000", "#f54e1e")) +
theme_void() +
labs(title = paste("md2","\n", "(PBANKA_1447900)")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 15, face = "bold"), legend.position = "none") +
## add sex symbols
annotate("text", x = 3.8, y = 1.5, label = male_symbol, size=7, color="gray") +
annotate("text", x = 2, y = 2.8, label = female_symbol, size=7, color="gray")
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
pm11 <- DimPlot(tenx.mutant.integrated, label = FALSE, repel = TRUE, pt.size = 0.1, cells.highlight = cells_21, group.by = "exclude_for_sex_ratio", dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_color_manual(values=c("#000000", "#f54e1e")) +
theme_void() +
labs(title = paste("fd1","\n", "(PBANKA_1454800)")) +
theme(plot.title = element_text(hjust = 0.5, family="Arial", size = 15, face = "bold"), legend.position = "none") +
## add sex symbols
annotate("text", x = 3.8, y = 1.5, label = male_symbol, size=7, color="gray") +
annotate("text", x = 2, y = 2.8, label = female_symbol, size=7, color="gray")
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
## plot composite plot
## not used as outside plots have odd sizes
#pm1 + pm2 + pm4 + pm5 + pm11 + pm7 + pm6 + pm8 + pm9 + pm10 + pm3
## plot composite plot
mutant_cell_locations <- plot_grid(pm2 + theme(plot.margin = unit(c(0, 0, 0, 0), "cm")), pm4 + theme(plot.margin = unit(c(0, 0, 0, 0), "cm")), pm5 + theme(plot.margin = unit(c(0, 0, 0, 0), "cm")), pm11 + theme(plot.margin = unit(c(0, 0, 0, 0), "cm")), pm7 + theme(plot.margin = unit(c(0, 0, 0, 0), "cm")), pm6 + theme(plot.margin = unit(c(0, 0, 0, 0), "cm")), pm8 + theme(plot.margin = unit(c(0, 0, 0, 0), "cm")), pm9 + theme(plot.margin = unit(c(0, 0, 0, 0), "cm")), pm10 + theme(plot.margin = unit(c(0, 0, 0, 0), "cm")), pm3+ theme(plot.margin = unit(c(0, 0, 0, 0), "cm")), nrow = 3)
font family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font databasefont family 'Arial' not found in PostScript font database
## print
mutant_cell_locations
save
```r
ggsave(\/Users/Andy/GCSKO/GCSKO_analysis_git/images_to_export/merge_umap_mutant_cell_locations.png\, plot = mutant_cell_locations, device = \png\, path = NULL, scale = 1, width = 30, height = 30, units = \cm\, dpi = 300, limitsize = TRUE)
<!-- rnb-source-end -->
<!-- rnb-chunk-end -->
<!-- rnb-text-begin -->
### Figure. Sup. Dot Plot Figures
#### Expression of Marker Genes by Cluster
We will use the following marker genes:
<!-- rnb-text-end -->
<!-- rnb-chunk-begin -->
<!-- rnb-source-begin eyJkYXRhIjoiYGBgclxuYGBgclxuIyBQQkFOS0EtMTMxOTUwMCAtIENDUDIgLSBmZW1hbGUgLSB1c2VkIGluIDgyMCBsaW5lXG4jIFBCQU5LQS0wNDE2MTAwIC0gTUcxIC0gZHluZW5pbiBoZWF2eSBjaGFpbiAtIG1hbGUgLSB1c2VkIGluIDgyMCBsaW5lXG4jIFBCQU5LQS0wODMxMDAwIC0gTVNQMSAtIGxhdGUgYXNleHVhbFxuIyBQQkFOS0EtMTEwMjIwMCAtIE1TUDggLSBlYXJseSBhc2V4dWFsIChmcm9tIEJvemRlY2ggcGFwZXIpXG4jIFBCQU5LQS0xNDM3NTAwIC0gQVAyRyAtIGNvbW1pdG1lbnRcbmBgYFxuYGBgIn0= -->
```r
```r
# PBANKA-1319500 - CCP2 - female - used in 820 line
# PBANKA-0416100 - MG1 - dynenin heavy chain - male - used in 820 line
# PBANKA-0831000 - MSP1 - late asexual
# PBANKA-1102200 - MSP8 - early asexual (from Bozdech paper)
# PBANKA-1437500 - AP2G - commitment
<!-- rnb-source-end -->
<!-- rnb-chunk-end -->
<!-- rnb-text-begin -->
plot expression of these marker genes in each cluster
<!-- rnb-text-end -->
<!-- rnb-chunk-begin -->
<!-- rnb-source-begin eyJkYXRhIjoiYGBgclxuIyMgY29weSB0aGUgY2x1c3RlcnMgc28geW91IGRvbid0IHBlcm1hbmVudGx5IGVkaXQgdGhlIG1hc3RlclxudGVueC5tdXRhbnQuaW50ZWdyYXRlZC53dEBtZXRhLmRhdGEkc2V1cmF0X2NsdXN0ZXJzX3Bsb3R0aW5nIDwtIHRlbngubXV0YW50LmludGVncmF0ZWQud3RAbWV0YS5kYXRhJHNldXJhdF9jbHVzdGVyc1xuXG4jIyByZW9yZGVyIHRoZSBsZXZlbHMgc28geW91IGNhbiBwbG90IHRoZSBjbHV0ZXJzIGFzIHlvdSB3aXNoXG5teV9sZXZlbHMgPC0gYyhhc2V4X2NsdXN0ZXJzLCBiaXBvdGVudGlhbF9jbHVzdGVycywgbWFsZV9jbHVzdGVycywgZmVtYWxlX2NsdXN0ZXJzKVxuXG4jIyByZW9yZGVyIHRoZSBsZXZlbHNcbnRlbngubXV0YW50LmludGVncmF0ZWQud3RAbWV0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ycykrMC41KSkpICtcbiAgIyMgYW5ub3RhdGUgYmlwb3RlbnRpYWxcbiAgZ2VvbV9obGluZShhZXMoeWludGVyY2VwdCA9IChsZW5ndGgoYyhhc2V4X2NsdXN0ZXJzLCBiaXBvdGVudGlhbF9jbHVzdGVycykpKzAuNSkpKSArXG4gICMjIGFubm90YXRlIHNleGVzXG4gIGdlb21faGxpbmUoYWVzKHlpbnRlcmNlcHQgPSAobGVuZ3RoKGMoYXNleF9jbHVzdGVycywgYmlwb3RlbnRpYWxfY2x1c3RlcnMsIG1hbGVfY2x1c3RlcnMpKSswLjUpKSkgK1xuICAjIyBjaGFuZ2UgbGFiZWwgb24gYm90dG9tIG9mIHBsb3Qgc28gd2UgY2FuIGluZGljYXRlIG1hcmtlcnNcbiAgc2NhbGVfeF9kaXNjcmV0ZShsYWJlbHMgPSByZXYoYyhwYXN0ZShcIlBCQU5LQS0xMTAyMjAwXCIsXCJcXG5cIiwgXCIoTVNQODsgZWFybHkgYXNleHVhbClcIiksIHBhc3RlKFwiUEJBTktBLTA4MzEwMDBcIixcIlxcblwiLCBcIihNU1AxOyBsYXRlIGFzZXh1YWwpXCIpLCBwYXN0ZShcIlBCQU5LQS0xNDM3NTAwXCIsIFwiXFxuXCIsIFwiKEFQMkc7IHNleHVhbCBjb21taXRtZW50KVwiKSwgcGFzdGUoXCJQQkFOS0EtMDQxNjEwMFwiLCBcIlxcblwiLCBcIihNRzE7IG1hbGUpXCIpLCBwYXN0ZShcIlBCQU5LQS0xMzE5NTAwXCIsIFwiXFxuXCIsIFwiKENDUDI7IGZlbWFsZSlcIikpKSlcbmBgYCJ9 -->
```r
## copy the clusters so you don't permanently edit the master
tenx.mutant.integrated.wt@meta.data$seurat_clusters_plotting <- tenx.mutant.integrated.wt@meta.data$seurat_clusters
## reorder the levels so you can plot the cluters as you wish
my_levels <- c(asex_clusters, bipotential_clusters, male_clusters, female_clusters)
## reorder the levels
tenx.mutant.integrated.wt@meta.data$seurat_clusters_plotting <- factor(x = tenx.mutant.integrated.wt@meta.data$seurat_clusters_plotting, levels = my_levels)
## plot
dot_plot_markers <- DotPlot(tenx.mutant.integrated.wt, features = c("PBANKA-1319500", "PBANKA-0416100", "PBANKA-1437500", "PBANKA-0831000", "PBANKA-1102200"), group.by = "seurat_clusters_plotting") +
theme_classic() +
# change appearance and remove axis elements, and make room for arrows
theme(axis.text.x = element_text(size=16, angle = 45, hjust=1,vjust=1, family = "Arial"), text=element_text(size=16, family="Arial"), legend.position = "bottom", legend.direction = "horizontal", legend.box = "vertical", plot.title = element_blank(), plot.margin = unit(c(1,3,1,3), "lines")) +
#change the colours
scale_colour_viridis(option = "inferno", guide = "colourbar", na.value="white", begin = 0, end = 1, direction = 1) +
## change x axis label
labs(x = "Marker Genes", y = "Cluster", title = "Expression of Marker Genes by Cluster") +
## add arrows
#annotate("segment", x = 5.5, xend = 5.5, y = 21.5, yend = 25, colour = "green", size=1, alpha=1, arrow=arrow(length=unit(0.30,"cm"), type = "closed")) +
#annotate("segment", x = 5.5, xend = 5.5, y = 16.5, yend = 21.5, colour = "red", size=1, alpha=1, arrow=arrow(length=unit(0.30,"cm"), type = "closed")) +
#annotate("segment", x = 5.5, xend = 5.5, y = 0, yend = 15.5, colour = "grey", size=1, alpha=1, arrow=arrow(length=unit(0.30,"cm"), type = "closed")) +
## annotate asex
geom_hline(aes(yintercept = (length(asex_clusters)+0.5))) +
## annotate bipotential
geom_hline(aes(yintercept = (length(c(asex_clusters, bipotential_clusters))+0.5))) +
## annotate sexes
geom_hline(aes(yintercept = (length(c(asex_clusters, bipotential_clusters, male_clusters))+0.5))) +
## change label on bottom of plot so we can indicate markers
scale_x_discrete(labels = rev(c(paste("PBANKA-1102200","\n", "(MSP8; early asexual)"), paste("PBANKA-0831000","\n", "(MSP1; late asexual)"), paste("PBANKA-1437500", "\n", "(AP2G; sexual commitment)"), paste("PBANKA-0416100", "\n", "(MG1; male)"), paste("PBANKA-1319500", "\n", "(CCP2; female)"))))
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
## view
print(dot_plot_markers)
gene identities for the mutants profiled
# PBANKA-0828000 GCSKO-3 GD1
# PBANKA-1302700 GCSKO-oom MD1
# PBANKA-1447900 GCSKO-29 MD2
# PBANKA-0102400 GCSKO-2 MD3
# PBANKA-0716500 GCSKO-19 MD4
# PBANKA-0413400 GCSKO-10_820 MD5
# PBANKA-1454800 GCSKO-21 FD1
# PBANKA-0902300 GCSKO-13 FD2
# PBANKA-1418100 GCSKO-17 FD3
# PBANKA-1435200 GCSKO-20 FD4
plot expression of these mutant genes by cluster
## plot
dot_plot_mutant_genes <- DotPlot(tenx.mutant.integrated.wt, features = c("PBANKA-0828000", "PBANKA-1302700", "PBANKA-1447900", "PBANKA-0102400", "PBANKA-0716500","PBANKA-1454800", "PBANKA-1418100", "PBANKA-0902300", "PBANKA-0413400", "PBANKA-1435200"), group.by = "seurat_clusters_plotting") +
theme_classic() +
## change appearance and remove axis elements, and make room for arrows, and also change posoition of legends relative to one another
theme(axis.text.x = element_text(size=12, angle = 45, hjust=1,vjust=1), legend.position = "bottom", legend.direction = "horizontal", legend.box = "vertical", plot.margin = unit(c(1,3,1,3), "lines"), text=element_text(size=16, family="Arial")) +
##add these to above to remove y = plot.title = element_blank(), axis.text.y = element_blank(), axis.ticks.y = element_blank(), axis.title.y = element_blank()
## change the colours
scale_colour_viridis(option = "inferno", guide = "colourbar", na.value="white", begin = 0, end = 1, direction = 1) +
## change x axis label
labs(x = "Mutant Genes", title = "Expression of mutant genes by cluster", y = "Cluster") +
## annotate asex
geom_hline(aes(yintercept = (length(asex_clusters)+0.5))) +
## annotate bipotential
geom_hline(aes(yintercept = (length(c(asex_clusters, bipotential_clusters))+0.5))) +
## annotate sexes
geom_hline(aes(yintercept = (length(c(asex_clusters, bipotential_clusters, male_clusters))+0.5))) +
## change label on bottom of plot so we can indicate markers
scale_x_discrete(labels = rev(c(paste("PBANKA-1435200", "\n", "fd4"),
paste("PBANKA-0413400","\n", "md5"),
paste("PBANKA-0902300", "\n", "fd2"),
paste("PBANKA-1418100", "\n", "fd3"),
paste("PBANKA_1454800","\n", "fd1"),
paste("PBANKA-0716500", "\n", "md4"),
paste("PBANKA-0102400", "\n", "md3"),
paste("PBANKA-1447900", "\n", "md2"),
paste("PBANKA-1302700", "\n", "md1"),
paste("PBANKA-0828000", "\n", "gd1"))))
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
## view
print(dot_plot_mutant_genes)
make a metadata column where the 10X data is classified as a WT genotype
## get cells that are filtered out
cells_10x <- which(tenx.mutant.integrated@meta.data$experiment == "tenx_5k")
## make extra column in plotting df
tenx.mutant.integrated@meta.data$genotype_combined <- tenx.mutant.integrated@meta.data$genotype
tenx.mutant.integrated@meta.data$genotype_combined[cells_10x] <- "WT"
## inspect
table(tenx.mutant.integrated@meta.data$genotype_combined)
Mutant WT
2028 6880
Plot expression of mutant genes by cluster (which is subdivided by genotype)
This is kind of a control because the mutant should express less of the gene of interest at some point due to the inclusion of the mutant cells
## plot
dot_plot_mutant_genes_genotype <- DotPlot(tenx.mutant.integrated, features = c("PBANKA-0828000", "PBANKA-1302700", "PBANKA-1447900", "PBANKA-0102400", "PBANKA-0716500", "PBANKA-1435200", "PBANKA-1418100", "PBANKA-1144800", "PBANKA-0902300", "PBANKA-0413400", "PBANKA-1454800"), group.by = "seurat_clusters_plotting", split.by = "genotype_combined") +
## make appearance smoother
theme_classic() +
## change appearance and remove axis elements, and make room for arrows
theme(axis.text.x = element_text(size=12, angle = 45, hjust=1,vjust=1), legend.position = "bottom", plot.title = element_blank(), plot.margin = unit(c(1,3,1,1), "lines")) +
## change the colours
#scale_colour_viridis(option = "inferno", guide = "colourbar", na.value="white", begin = 0, end = 1, direction = 1) +
## change x axis label
labs(x = "Marker Genes") +
## annotate males
geom_hline(aes(yintercept = 56.5)) +
## annotate females
geom_hline(aes(yintercept = 48.5)) +
## annotate hermaphrodite
geom_hline(aes(yintercept = 46.5))
## change label on bottom of plot so we can indicate markers
#scale_x_discrete(labels = c(paste("PBANKA-1102200","\n", "(MSP8; early asexual)"), paste("PBANKA-0831000","\n", "(MSP1; late asexual)"), paste("PBANKA-1437500", "\n", "(AP2G; sexual commitment)"), paste("PBANKA-0416100", "\n", "(MG1; male)"), paste("PBANKA-1319500", "\n", "(CCP2; female)")))
## view
print(dot_plot_mutant_genes_genotype)
## plot
dot_plot_mutants_experiment <- DotPlot(tenx.mutant.integrated, features = c("PBANKA-0828000", "PBANKA-1302700", "PBANKA-1447900", "PBANKA-0102400", "PBANKA-0716500", "PBANKA-1435200", "PBANKA-1418100", "PBANKA-1144800", "PBANKA-0902300", "PBANKA-0413400", "PBANKA-1454800"), group.by = "seurat_clusters_plotting", split.by = "sub_genotype", cols = c("red", "blue", "green")) +
theme_classic() +
# change appearance and remove axis elements, and make room for arrows
theme(axis.text.x = element_text(size=12, angle = 45, hjust=1,vjust=1), legend.position = "bottom", plot.title = element_blank(), plot.margin = unit(c(1,3,1,1), "lines")) +
#change the colours
#scale_colour_viridis(option = "inferno", guide = "colourbar", na.value="white", begin = 0, end = 1, direction = 1) +
## change x axis label
labs(x = "Marker Genes") +
## annotate males
geom_hline(aes(yintercept = 77)) +
## annotate females
geom_hline(aes(yintercept = 61)) +
## annotate hermaphrodite
geom_hline(aes(yintercept = 59))
## change label on bottom of plot so we can indicate markers
#scale_x_discrete(labels = c(paste("PBANKA-1102200","\n", "(MSP8; early asexual)"), paste("PBANKA-0831000","\n", "(MSP1; late asexual)"), paste("PBANKA-1437500", "\n", "(AP2G; sexual commitment)"), paste("PBANKA-0416100", "\n", "(MG1; male)"), paste("PBANKA-1319500", "\n", "(CCP2; female)")))
## view
print(dot_plot_mutants_experiment)
Add a meta.data column so that 10X is listed as WT:
## get cells that are filtered out
mutant_cells <- which(tenx.mutant.integrated$experiment == "mutants")
## make extra column in plotting df
tenx.mutant.integrated@meta.data$identity_combined <- "WT_10X"
tenx.mutant.integrated@meta.data$identity_combined[mutant_cells] <- tenx.mutant.integrated@meta.data$identity_updated[mutant_cells]
prepare data for dotplotting
## make a dataframe that is a copy of the meta data
df_meta_data <- as.data.frame(tenx.mutant.integrated@meta.data)
## redefine order of clusters:
df_meta_data$seurat_clusters <- factor(x = df_meta_data$seurat_clusters, levels = my_levels)
## make a new df of CLUSTER and IDENTITY
dot_plot_df <- as.data.frame.matrix(table(df_meta_data$seurat_clusters, df_meta_data$identity_combined))
dot_plot_df$cluster <- rownames(dot_plot_df)
## calculate percentage of cells for each genotype
dot_plot_df_pc <- (as.data.frame.matrix(prop.table(table(df_meta_data$seurat_clusters, df_meta_data$identity_combined), margin = 2)) * 100)
## make a column for cluster names
dot_plot_df_pc$cluster <- rownames(dot_plot_df_pc)
## melt dataframe for plotting
library(reshape2)
dot_plot_df_pc_melted <- melt(dot_plot_df_pc, variable.name = "cluster")
Using cluster as id variables
colnames(dot_plot_df_pc_melted)[2] <- "identity"
## melt the raw number too
dot_plot_df_melted <- melt(dot_plot_df, variable.name = "cluster")
Using cluster as id variables
colnames(dot_plot_df_melted)[2] <- "identity"
colnames(dot_plot_df_melted)[3] <- "raw_number"
## merge together
identical(dot_plot_df_melted$cluster, dot_plot_df_pc_melted$cluster)
[1] TRUE
dot_plot_merged <- cbind(dot_plot_df_melted, dot_plot_df_pc_melted)
dot_plot_merged <- dot_plot_merged[,c(1,2,3,6)]
## redefine order of clusters
dot_plot_merged$cluster <- factor(x = dot_plot_merged$cluster, levels = my_levels)
## where values are zero, add NA
## find wells where it's zero
zero_values <- dot_plot_merged$value == 0
dot_plot_merged$value[zero_values] <- NA
## also do for raw number
zero_values <- dot_plot_merged$raw_number == 0
dot_plot_merged$raw_number[zero_values] <- NA
## reorder x axis:
my_levels_genotype <- c("GCSKO-oom", "GCSKO-29", "GCSKO-3", "GCSKO-2", "GCSKO-19", "GCSKO-28", "GCSKO-21", "GCSKO-13", "GCSKO-17", "GCSKO-20", "GCSKO-10_820", "WT", "WT_10X")
dot_plot_merged$identity <- factor(x = dot_plot_df_pc_melted$identity, levels = my_levels_genotype)
plot
dot_plot_identity <- ggplot(dot_plot_merged, aes(y = factor(cluster), x = factor(identity))) +
## make into a dot plot
geom_point(aes(colour=value, size=raw_number)) +
scale_color_gradient(low="blue", high="red", limits=c( 0, max(dot_plot_df_pc_melted$value)), na.value="white") +
#change the colours
scale_colour_viridis(option = "inferno", guide = "colourbar", na.value="white") +
theme_classic() +
theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) +
ylab("Cluster") +
xlab("Identity") +
labs(colour = "% cells of that genotype represented in that cluster", size = "number of cells of that genotype represented in that cluster") +
theme(axis.text.x=element_text(size=12, angle=45, hjust=1, vjust=1), axis.text.y=element_text(size=12), legend.position = "bottom", legend.direction = "horizontal", legend.box = "vertical", text=element_text(size=16, family="Arial")) +
## annotate asex
geom_hline(aes(yintercept = (length(asex_clusters)+0.5))) +
## annotate bipotential
geom_hline(aes(yintercept = (length(c(asex_clusters, bipotential_clusters))+0.5))) +
## annotate sexes
geom_hline(aes(yintercept = (length(c(asex_clusters, bipotential_clusters, male_clusters))+0.5)))
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
#title = "% genotype population found in each cluster",
print(dot_plot_identity)
maybe the respresentation differences have batch-effects:
```r
#table(tenx.mutant.integrated@meta.data$sort_date, tenx.mutant.integrated@meta.data$identity_updated)
<!-- rnb-source-end -->
<!-- rnb-chunk-end -->
<!-- rnb-text-begin -->
#### Compose Final Plot
<!-- rnb-text-end -->
<!-- rnb-chunk-begin -->
<!-- rnb-source-begin eyJkYXRhIjoiYGBgclxuZG90X3Bsb3RfaWRlbnRpdHkgKyBkb3RfcGxvdF9tYXJrZXJzICsgZG90X3Bsb3RfbXV0YW50X2dlbmVzXG5gYGAifQ== -->
```r
dot_plot_identity + dot_plot_markers + dot_plot_mutant_genes
Make a subsetted Seurat object of sexual cells.
Include the pre-branch too as well as any weird clusters that may have clustered out.
it’s been a while since we looked at the clusters so let’s check them out again:
## define cells
## 2 and 0 are at the beginning of the stalk
sex_clusters <- c(bipotential_clusters, female_clusters, male_clusters, "5", "7")
## subset cells into new object
tenx.mutant.integrated.sex <- subset(tenx.mutant.integrated, idents = sex_clusters)
## inspect object
tenx.mutant.integrated.sex
An object of class Seurat
10116 features across 3020 samples within 2 assays
Active assay: integrated (5018 features, 2000 variable features)
1 other assay present: RNA
3 dimensional reductions calculated: pca, umap, DIM_UMAP
## look at original UMAP
DimPlot(tenx.mutant.integrated.sex, label = TRUE, repel = TRUE, pt.size = 0.1, split.by = "experiment", dims = c(2,1), reduction = "DIM_UMAP") + coord_fixed()
we want to remove:
## look at original UMAP
plot_sexual_subsetting <- DimPlot(tenx.mutant.integrated.sex, label = TRUE, repel = TRUE, pt.size = 0.1, dims = c(2,1), reduction = "DIM_UMAP") + coord_fixed() + geom_hline(aes(yintercept = -0.80, alpha = 5)) + geom_vline(aes(xintercept = -0.1, alpha = 5))
plot_sexual_subsetting
Look interactively:
HoverLocator(plot = plot_sexual_subsetting, information = FetchData(object = tenx.mutant.integrated.sex, vars = 'identity_name_updated'))
`arrange_()` is deprecated as of dplyr 0.7.0.
Please use `arrange()` instead.
See vignette('programming') for more help
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.the condition has length > 1 and only the first element will be usedthe condition has length > 1 and only the first element will be used`error_y.color` does not currently support multiple values.`error_x.color` does not currently support multiple values.`line.color` does not currently support multiple values.The titlefont attribute is deprecated. Use title = list(font = ...) instead.the condition has length > 1 and only the first element will be usedthe condition has length > 1 and only the first element will be used`error_y.color` does not currently support multiple values.`error_x.color` does not currently support multiple values.`line.color` does not currently support multiple values.The titlefont attribute is deprecated. Use title = list(font = ...) instead.
## extract cell embeddings
df_sex_cell_embeddings <- as.data.frame(tenx.mutant.integrated.sex@reductions[["DIM_UMAP"]]@cell.embeddings)
## subset anything lower than -0.8 in UMAP 2 and -0.1 in UMAP 1
remove_cells <- row.names(df_sex_cell_embeddings[which(df_sex_cell_embeddings$DIMUMAP_2 < -0.1 | df_sex_cell_embeddings$DIMUMAP_1 < -0.8), ])
## plot these cells
DimPlot(tenx.mutant.integrated.sex, label = FALSE, repel = TRUE, pt.size = 0.1, cells.highlight = remove_cells, dims = c(2,1), reduction = "DIM_UMAP") +
coord_fixed() +
scale_color_manual(values=c("#000000", "#f54e1e")) +
theme_void() +
labs(title = paste("cells highlighted will be removed")) +
theme(plot.title = element_text(hjust = 0.5), legend.position = "none")
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the
existing scale.
DimPlot(tenx.mutant.integrated.sex, label = FALSE, repel = TRUE, pt.size = 1, dims = c(2,1), reduction = "DIM_UMAP", group.by = "identity_combined") +
coord_fixed()
then check what the IDs of these cells are to ensure they aren’t a genuine mutant signature
tenx.mutant.integrated.sex@meta.data[rownames(tenx.mutant.integrated.sex@meta.data) %in% remove_cells, ]$identity_combined
[1] "WT_10X" "GCSKO-21" "GCSKO-21" "GCSKO-19" "WT" "GCSKO-10_820"
[7] "GCSKO-10_820" "WT"
Although there are a number of GCSKO-21 cells, there are still many remaining in the sex cluster above and the cells near the asexual cycle also have a GCSKO-17 cell with them and are therefore not exclusively belonging to that mutant so we will remove these cells.
## make keep cells from the remove_cells
## make the not in function
'%ni%' <- Negate('%in%')
keep_cells <- colnames(tenx.mutant.integrated.sex)[which(colnames(tenx.mutant.integrated.sex) %ni% remove_cells)]
## subset
tenx.mutant.integrated.sex <- subset(tenx.mutant.integrated.sex, cells = keep_cells)
## inspect
tenx.mutant.integrated.sex
An object of class Seurat
10116 features across 3012 samples within 2 assays
Active assay: integrated (5018 features, 2000 variable features)
1 other assay present: RNA
3 dimensional reductions calculated: pca, umap, DIM_UMAP
copy old clusters over
## copy old clusters
tenx.mutant.integrated.sex <- AddMetaData(tenx.mutant.integrated.sex, tenx.mutant.integrated.sex@meta.data$seurat_clusters, col.name = "post_integration_clusters")
## extract data from Seurat
seurat.object.all <- tenx.mutant.integrated
# counts
data <- as(as.matrix(GetAssayData(seurat.object.all, assay = "integrated", slot = "data")), 'sparseMatrix')
# meta data
pd <- data.frame(seurat.object.all@meta.data)
## keep only the columns that are relevant
#pData <- pd %>% select(orig.ident, nCount_RNA, nFeature_RNA)
## add gene short name
fData <- data.frame(gene_short_name = row.names(data), row.names = row.names(data))
## Construct monocle cds
monocle.object.all <- new_cell_data_set(expression_data = data, cell_metadata = pd, gene_metadata = fData)
## preprocess
monocle.object.all = preprocess_cds(monocle.object.all, num_dim = 100, norm_method = "none")
## plot variance explained plot
plot_pc_variance_explained(monocle.object.all)
## make monocle UMAP
#monocle.object.all = reduce_dimension(monocle.object.all, reduction_method = "UMAP", preprocess_method = "PCA", umap.metric = "euclidean", umap.n_neighbors = 20, umap.min_dist = 0.5, verbose = FALSE)
#plot_cells(monocle.object.all)
## add UMAP from Seurat
monocle.object.all@int_colData@listData$reducedDims@listData[["UMAP"]] <-seurat.object.all@reductions[["DIM_UMAP"]]@cell.embeddings
plot_cells(monocle.object.all)
No trajectory to plot. Has learn_graph() been called yet?
cluster not found in colData(cds), cells will not be colored
cluster_cells() has not been called yet, can't color cells by cluster
## cluster
monocle.object.all = cluster_cells(monocle.object.all)
## plot clusters
plot_cells(monocle.object.all, color_cells_by="partition", group_cells_by="partition", x = 2, y = 1)
No trajectory to plot. Has learn_graph() been called yet?
The `add` argument of `group_by()` is deprecated as of dplyr 1.0.0.
Please use the `.add` argument instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.
## reduce partitions to 1
monocle.object.all@clusters$UMAP$partitions[monocle.object.all@clusters$UMAP$partitions == "2"] <- "1"
#map pseudotime
monocle.object.all = learn_graph(monocle.object.all, learn_graph_control=list(ncenter=500), use_partition = FALSE)
|
| | 0%
|
|=======================================================================================================================| 100%
plot_cells(monocle.object.all, color_cells_by="partition", group_cells_by="partition", x = 2, y = 1)
`select_()` is deprecated as of dplyr 0.7.0.
Please use `select()` instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.
## a helper function to identify the root principal points:
## make cluster 2 the root
get_earliest_principal_node <- function(cds, time_bin="7"){
cell_ids <- which(colData(cds)[, "seurat_clusters"] == time_bin)
closest_vertex <-
cds@principal_graph_aux[["UMAP"]]$pr_graph_cell_proj_closest_vertex
closest_vertex <- as.matrix(closest_vertex[colnames(cds), ])
root_pr_nodes <-
igraph::V(principal_graph(cds)[["UMAP"]])$name[as.numeric(names
(which.max(table(closest_vertex[cell_ids,]))))]
root_pr_nodes
}
## calculate pseudotime
#monocle.object.all = order_cells(monocle.object.all, root_pr_nodes=get_earliest_principal_node(monocle.object.all))
monocle.object.all = order_cells(monocle.object.all)
Loading required package: shiny
Listening on http://127.0.0.1:4574
## plot
umap_pt <- plot_cells(monocle.object.all, color_cells_by = "pseudotime", label_cell_groups=FALSE, cell_size = 1, x = 2, y = 1, label_branch_points=FALSE, label_leaves=FALSE, label_groups_by_cluster=FALSE, label_roots = FALSE) +
coord_fixed() +
theme_void() +
labs(title = "") +
theme(plot.title = element_text(hjust = 0.5, size=20), legend.position="bottom", legend.title=element_text (size=20), legend.text=element_text(size=20)) +
guides(colour = guide_colourbar(barwidth = 10, barheight = 2, title = "Pseudotime"))
## view plot
umap_pt
## help was obtained from here
## https://github.com/satijalab/seurat/issues/1658
save
ggsave("../images_to_export/pt_all_UMAP_pt.png", plot = umap_pt, device = "png", path = NULL, scale = 1, width = 20, height = 20, units = "cm", dpi = 300, limitsize = TRUE)
#install.packages("gganimate")
library(gganimate)
#install.packages("gifski")
#install.packages("av")
#library(gifski)
#library(av)
## make dataframe for plotting
## extract data for GGplot version of this
df_animation <- as.data.frame(monocle.object.all@int_colData@listData$reducedDims@listData[["UMAP"]])
## add pt to this data frame:
pt_values <- as.data.frame(pseudotime(monocle.object.all, reduction_method = "UMAP"))
df_animation <- merge(df_animation, pt_values, by="row.names")
rownames(df_animation) <- df_animation$Row.names
colnames(df_animation)[4] <- "pt"
## make the static plot
p <- ggplot(df_animation, aes(x = DIMUMAP_2, y = DIMUMAP_1, colour = pt)) +
geom_point() +
scale_colour_viridis_c(option = "plasma") +
coord_fixed() +
theme_void() +
theme(legend.position = "none")
## view plot
plot(p)
## make animated plot
## make a category for animation
#df_animation$group <- cut(df_animation$pt, 15)
anim <- p +
transition_time(pt) +
shadow_mark()
animate(anim, height = 3, width = 3, units = "in", res = 150, bg = 'transparent')
Frame 1 (1%)
Frame 2 (2%)
Frame 3 (3%)
Frame 4 (4%)
Frame 5 (5%)
Frame 6 (6%)
Frame 7 (7%)
Frame 8 (8%)
Frame 9 (9%)
Frame 10 (10%)
Frame 11 (11%)
Frame 12 (12%)
Frame 13 (13%)
Frame 14 (14%)
Frame 15 (15%)
Frame 16 (16%)
Frame 17 (17%)
Frame 18 (18%)
Frame 19 (19%)
Frame 20 (20%)
Frame 21 (21%)
Frame 22 (22%)
Frame 23 (23%)
Frame 24 (24%)
Frame 25 (25%)
Frame 26 (26%)
Frame 27 (27%)
Frame 28 (28%)
Frame 29 (29%)
Frame 30 (30%)
Frame 31 (31%)
Frame 32 (32%)
Frame 33 (33%)
Frame 34 (34%)
Frame 35 (35%)
Frame 36 (36%)
Frame 37 (37%)
Frame 38 (38%)
Frame 39 (39%)
Frame 40 (40%)
Frame 41 (41%)
Frame 42 (42%)
Frame 43 (43%)
Frame 44 (44%)
Frame 45 (45%)
Frame 46 (46%)
Frame 47 (47%)
Frame 48 (48%)
Frame 49 (49%)
Frame 50 (50%)
Frame 51 (51%)
Frame 52 (52%)
Frame 53 (53%)
Frame 54 (54%)
Frame 55 (55%)
Frame 56 (56%)
Frame 57 (57%)
Frame 58 (58%)
Frame 59 (59%)
Frame 60 (60%)
Frame 61 (61%)
Frame 62 (62%)
Frame 63 (63%)
Frame 64 (64%)
Frame 65 (65%)
Frame 66 (66%)
Frame 67 (67%)
Frame 68 (68%)
Frame 69 (69%)
Frame 70 (70%)
Frame 71 (71%)
Frame 72 (72%)
Frame 73 (73%)
Frame 74 (74%)
Frame 75 (75%)
Frame 76 (76%)
Frame 77 (77%)
Frame 78 (78%)
Frame 79 (79%)
Frame 80 (80%)
Frame 81 (81%)
Frame 82 (82%)
Frame 83 (83%)
Frame 84 (84%)
Frame 85 (85%)
Frame 86 (86%)
Frame 87 (87%)
Frame 88 (88%)
Frame 89 (89%)
Frame 90 (90%)
Frame 91 (91%)
Frame 92 (92%)
Frame 93 (93%)
Frame 94 (94%)
Frame 95 (95%)
Frame 96 (96%)
Frame 97 (97%)
Frame 98 (98%)
Frame 99 (99%)
Frame 100 (100%)
Finalizing encoding... done!
## to change the resolution - https://stackoverflow.com/questions/49058567/define-size-for-gif-created-by-gganimate-change-dimension-resolution
Save animation
anim_save("animated_UMAP_transparent_bg.gif", path = "../images_to_export/")
## extract pt values
pt_values <- as.data.frame(pseudotime(monocle.object.all, reduction_method = "UMAP"))
tenx.mutant.integrated <- AddMetaData(tenx.mutant.integrated, pt_values, "old_pt_values")
make composite pseudotime/ID figure
test <- df_umap_plot[which(df_umap_plot$cluster_colours_figure == "Male"), ]
ggplot(test, aes(x = DIMUMAP_2, y = DIMUMAP_1)) +
geom_point() +
theme_void()
Save environment
```r
## This saves everything in the global environment for easy recall later
#save.image(file = \GCSKO_merge.RData\)
#load(file = \GCSKO_merge.RData\)
<!-- rnb-source-end -->
<!-- rnb-chunk-end -->
<!-- rnb-text-begin -->
Save object(s)
<!-- rnb-text-end -->
<!-- rnb-chunk-begin -->
<!-- rnb-source-begin eyJkYXRhIjoiYGBgclxuIyMgU2F2ZSBhbiBvYmplY3QgdG8gYSBmaWxlXG5zYXZlUkRTKHRlbngubXV0YW50LmludGVncmF0ZWQuc2V4LCBmaWxlID0gXCIuLi9kYXRhX3RvX2V4cG9ydC90ZW54Lm11dGFudC5pbnRlZ3JhdGVkLnNleC5SRFNcIilcbiMjIFJlc3RvcmUgdGhlIG9iamVjdFxuI3JlYWRSRFMoZmlsZSA9IFwiLi4vZGF0YV90b19leHBvcnQvdGVueC5tdXRhbnQuaW50ZWdyYXRlZC5zZXguUkRTXCIpXG5cbiMjIHNhdmUgaW50ZWdyYXRlZCBvYmplY3QgdG8gZmlsZVxuc2F2ZVJEUyh0ZW54Lm11dGFudC5pbnRlZ3JhdGVkLCBmaWxlID0gXCIuLi9kYXRhX3RvX2V4cG9ydC90ZW54Lm11dGFudC5pbnRlZ3JhdGVkLlJEU1wiKSBcbiMjIHJlc3RvcmUgdGhlIG9iamVjdFxuI3RlbngubXV0YW50LmludGVncmF0ZWQgPC0gcmVhZFJEUyhcIi4uL2RhdGFfdG9fZXhwb3J0L3RlbngubXV0YW50LmludGVncmF0ZWQuUkRTXCIpXG5gYGAifQ== -->
```r
## Save an object to a file
saveRDS(tenx.mutant.integrated.sex, file = "../data_to_export/tenx.mutant.integrated.sex.RDS")
## Restore the object
#readRDS(file = "../data_to_export/tenx.mutant.integrated.sex.RDS")
## save integrated object to file
saveRDS(tenx.mutant.integrated, file = "../data_to_export/tenx.mutant.integrated.RDS")
## restore the object
#tenx.mutant.integrated <- readRDS("../data_to_export/tenx.mutant.integrated.RDS")
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats4 parallel grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] gganimate_1.0.7 shiny_1.5.0 circlize_0.4.12 destiny_3.2.0
[5] monocle3_0.2.3.0 SingleCellExperiment_1.10.1 SummarizedExperiment_1.18.2 DelayedArray_0.14.1
[9] matrixStats_0.57.0 GenomicRanges_1.40.0 GenomeInfoDb_1.24.2 IRanges_2.22.2
[13] S4Vectors_0.26.1 Biobase_2.48.0 BiocGenerics_0.34.0 Nebulosa_1.2.0
[17] dplyr_1.0.2 reshape2_1.4.4 Hmisc_4.4-1 ggplot2_3.3.2
[21] Formula_1.2-4 survival_3.2-7 lattice_0.20-41 gridExtra_2.3
[25] cowplot_1.1.0 Seurat_3.2.2 viridis_0.5.1 viridisLite_0.3.0
[29] patchwork_1.0.1
loaded via a namespace (and not attached):
[1] reticulate_1.18 ks_1.12.0 tidyselect_1.1.0 htmlwidgets_1.5.2
[5] ranger_0.12.1 Rtsne_0.15 devtools_2.3.2 munsell_0.5.0
[9] codetools_0.2-16 ica_1.0-2 future_1.19.1 gifski_0.8.6
[13] miniUI_0.1.1.1 withr_2.3.0 colorspace_1.4-1 knitr_1.30
[17] rstudioapi_0.11 ROCR_1.0-11 robustbase_0.93-7 vcd_1.4-8
[21] tensor_1.5 VIM_6.1.0 TTR_0.24.2 listenv_0.8.0
[25] labeling_0.4.2 GenomeInfoDbData_1.2.3 polyclip_1.10-0 farver_2.0.3
[29] pheatmap_1.0.12 rprojroot_1.3-2 vctrs_0.3.4 generics_0.0.2
[33] xfun_0.18 ggthemes_4.2.4 R6_2.5.0 rsvd_1.0.3
[37] RcppEigen_0.3.3.7.0 bitops_1.0-6 spatstat.utils_1.17-0 assertthat_0.2.1
[41] promises_1.1.1 scales_1.1.1 nnet_7.3-14 gtable_0.3.0
[45] globals_0.13.1 processx_3.4.4 goftest_1.2-2 rlang_0.4.8
[49] scatterplot3d_0.3-41 GlobalOptions_0.1.2 splines_4.0.3 lazyeval_0.2.2
[53] hexbin_1.28.1 checkmate_2.0.0 BiocManager_1.30.10 yaml_2.2.1
[57] abind_1.4-5 crosstalk_1.1.0.1 backports_1.1.10 httpuv_1.5.4
[61] tools_4.0.3 usethis_1.6.3 ellipsis_0.3.1 RColorBrewer_1.1-2
[65] proxy_0.4-24 sessioninfo_1.1.1 ggridges_0.5.2 Rcpp_1.0.6
[69] plyr_1.8.6 base64enc_0.1-3 progress_1.2.2 zlibbioc_1.34.0
[73] purrr_0.3.4 RCurl_1.98-1.2 ps_1.4.0 prettyunits_1.1.1
[77] rpart_4.1-15 deldir_0.1-29 pbapply_1.4-3 zoo_1.8-8
[81] haven_2.3.1 ggrepel_0.8.2 cluster_2.1.0 fs_1.5.0
[85] magrittr_2.0.1 data.table_1.13.2 RSpectra_0.16-0 openxlsx_4.2.2
[89] lmtest_0.9-38 RANN_2.6.1 pcaMethods_1.80.0 mvtnorm_1.1-1
[93] fitdistrplus_1.1-1 pkgload_1.1.0 hms_0.5.3 mime_0.9
[97] evaluate_0.14 xtable_1.8-4 smoother_1.1 rio_0.5.16
[101] jpeg_0.1-8.1 readxl_1.3.1 mclust_5.4.7 shape_1.4.5
[105] testthat_2.3.2 compiler_4.0.3 tibble_3.0.4 KernSmooth_2.23-17
[109] crayon_1.3.4 htmltools_0.5.1.1 mgcv_1.8-33 later_1.1.0.1
[113] tidyr_1.1.2 tweenr_1.0.1 MASS_7.3-53 boot_1.3-25
[117] leidenbase_0.1.2 car_3.0-10 Matrix_1.2-18 cli_2.1.0
[121] igraph_1.2.6 forcats_0.5.0 pkgconfig_2.0.3 laeken_0.5.1
[125] sp_1.4-4 foreign_0.8-80 plotly_4.9.2.1 XVector_0.28.0
[129] stringr_1.4.0 callr_3.5.1 digest_0.6.27 sctransform_0.3.1
[133] RcppAnnoy_0.0.16 spatstat.data_1.4-3 cellranger_1.1.0 rmarkdown_2.5
[137] leiden_0.3.3 htmlTable_2.1.0 uwot_0.1.8 DelayedMatrixStats_1.10.1
[141] curl_4.3 ggplot.multistats_1.0.0 lifecycle_0.2.0 nlme_3.1-149
[145] jsonlite_1.7.1 carData_3.0-4 desc_1.2.0 fansi_0.4.1
[149] pillar_1.4.6 DEoptimR_1.0-8 fastmap_1.0.1 httr_1.4.2
[153] pkgbuild_1.1.0 xts_0.12.1 glue_1.4.2 remotes_2.2.0
[157] zip_2.1.1 spatstat_1.64-1 png_0.1-7 class_7.3-17
[161] stringi_1.5.3 RcppHNSW_0.3.0 latticeExtra_0.6-29 memoise_1.1.0
[165] irlba_2.3.3 e1071_1.7-4 future.apply_1.6.0
– Subset only 10X cells
– cluster 24 is predetermination cells – cluster 29 is post cells – cluster 36 is post cells
```r
## Subset 10X Dataset, cluster 24
## extract only cells in cluster 24
seurat.object.subset <- SubsetData(tenx.mutant.integrated, subset.name = \seurat_clusters\, accept.value = c(\24\))
## get the names of the cells in cluster of interest
names_of_cells_in_cluster_24 <- colnames(seurat.object.subset@assays$RNA@counts)
## subset seurat
tenx_cluster_24 <- SubsetData(pb_sex_filtered, cells = names_of_cells_in_cluster_24)
## extract data
tenx_cluster_24_matrix_data <- as(as.matrix(GetAssayData(tenx_cluster_24, assay = \RNA\, slot = \data\)), 'sparseMatrix')
## extract counts
tenx_cluster_24_matrix_counts <- as(as.matrix(GetAssayData(tenx_cluster_24, assay = \RNA\, slot = \counts\)), 'sparseMatrix')
## extract meta data
## make big meta data dataframe
meta_df <- data.frame(tenx.mutant.integrated.sex@meta.data)
#meta_df <- data.frame(tenx.mutant.integrated@meta.data)
tenx_cluster_24_pd <- meta_df[which(rownames(meta_df) %in% colnames(tenx_cluster_24_matrix_counts)), ]
# save all 3 files
#write.csv(tenx_cluster_24_matrix_data, file = \~/data_to_export/tenx_cluster_24_matrix_data.csv\)
#write.csv(tenx_cluster_24_matrix_counts, file = \~/data_to_export/tenx_cluster_24_matrix_counts.csv\)
write.csv(tenx_cluster_24_pd, file = \~/data_to_export/tenx_cluster_24_pd.csv\)
## Subset 10X Dataset, cluster 29
# extract only cells in cluster 29
seurat.object.subset <- SubsetData(tenx.mutant.integrated, subset.name = \seurat_clusters\, accept.value = c(\29\))
#get the names of the cells in cluster of interest
names_of_cells_in_cluster_29 <- colnames(seurat.object.subset@assays$RNA@counts)
# subset seurat
tenx_cluster_29 <- SubsetData(pb_sex_filtered, cells = names_of_cells_in_cluster_29)
# extract data
tenx_cluster_29_matrix_data <- as(as.matrix(GetAssayData(tenx_cluster_29, assay = \RNA\, slot = \data\)), 'sparseMatrix')
# extract counts
tenx_cluster_29_matrix_counts <- as(as.matrix(GetAssayData(tenx_cluster_29, assay = \RNA\, slot = \counts\)), 'sparseMatrix')
# extract meta data
tenx_cluster_29_pd <- meta_df[which(rownames(meta_df) %in% colnames(tenx_cluster_29_matrix_counts)), ]
# save all 3 files
#write.csv(tenx_cluster_29_matrix_data, file = \~/data_to_export/tenx_cluster_29_matrix_data.csv\)
#write.csv(tenx_cluster_29_matrix_counts, file = \~/data_to_export/tenx_cluster_29_matrix_counts.csv\)
write.csv(tenx_cluster_29_pd, file = \~/data_to_export/tenx_cluster_29_pd.csv\)
## Subset 10X Dataset, cluster 36
# extract only cells in cluster 36
seurat.object.subset <- SubsetData(tenx.mutant.integrated, subset.name = \seurat_clusters\, accept.value = c(\36\))
#get the names of the cells in cluster of interest
names_of_cells_in_cluster_36 <- colnames(seurat.object.subset@assays$RNA@counts)
# subset seurat
tenx_cluster_36 <- SubsetData(pb_sex_filtered, cells = names_of_cells_in_cluster_36)
# extract data
tenx_cluster_36_matrix_data <- as(as.matrix(GetAssayData(tenx_cluster_36, assay = \RNA\, slot = \data\)), 'sparseMatrix')
# extract counts
tenx_cluster_36_matrix_counts <- as(as.matrix(GetAssayData(tenx_cluster_36, assay = \RNA\, slot = \counts\)), 'sparseMatrix')
# extract meta data
tenx_cluster_36_pd <- meta_df[which(rownames(meta_df) %in% colnames(tenx_cluster_36_matrix_counts)), ]
# save all 3 files
#write.csv(tenx_cluster_36_matrix_data, file = \~/data_to_export/tenx_cluster_36_matrix_data.csv\)
#write.csv(tenx_cluster_36_matrix_counts, file = \~/data_to_export/tenx_cluster_36_matrix_counts.csv\)
write.csv(tenx_cluster_36_pd, file = \~/data_to_export/tenx_cluster_36_pd.csv\)
<!-- rnb-source-end -->
<!-- rnb-chunk-end -->
<!-- rnb-text-begin -->
### old code
<!-- rnb-text-end -->
<!-- rnb-chunk-begin -->
<!-- rnb-source-begin eyJkYXRhIjoiYGBgclxuIyMgb2xkIHRocmVzaG9sZHMgb24gZGF0YSB3aXRoIDI4XG4jcmVtb3ZlX2NlbGxzIDwtIHJvdy5uYW1lcyhkZl9zZXhfY2VsbF9lbWJlZGRpbmdzW3doaWNoKGRmX3NleF9jZWxsX2VtYmVkZGluZ3MkRElNVU1BUF8yIDwgMC4xICYgZGZfc2V4X2NlbGxfZW1iZWRkaW5ncyRESU1VTUFQXzEgPiAtMS4yKSwgXSlcbmBgYCJ9 -->
```r
## old thresholds on data with 28
#remove_cells <- row.names(df_sex_cell_embeddings[which(df_sex_cell_embeddings$DIMUMAP_2 < 0.1 & df_sex_cell_embeddings$DIMUMAP_1 > -1.2), ])
Cowplot(plot_grid), patchwork(wrap_plots), and ggpubr can all allow multiple plots to be plotted together.
## A
# umap_id_pt
## B
# marker gene expression
## C
# Mutant gene expression
## D
# Modules
#Figure_A <- grid.arrange(arrangeGrob(QC_composite_plot, QC_mito_violin, QC_mito_graph, QC_by_genotype, mapping_rate_plot), nrow=3), nrow=2, heights=c(10,2))
## cowplot method
## can use this for labels: toupper(letters)[1:10]
## C. Mutant genes
mutant_genes_figure <- plot_grid(
## marker genes starts
list_of_density_plots[[8]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=7)) + labs(title = paste("Fam-b2 (Ring)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots[[5]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=7)) + labs(title = paste("MSP8 (Asexual)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots[[4]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=7)) + labs(title = paste("MSP1 (Schizont)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots[[3]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=7)) + labs(title = paste("AP2G (Commitment)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30)) )+ guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots[[1]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=7)) +
labs(title = paste("CCP2 (Female)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots[[2]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=7)) + labs(title = paste("MG1 (Male)")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
## mutant genes starts
list_of_density_plots_mutant_genes[[1]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=9)) + labs(title = paste("gd1")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots_mutant_genes[[2]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=9)) + labs(title = paste("md1")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots_mutant_genes[[3]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=9)) + labs(title = paste("md2")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots_mutant_genes[[4]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=9)) + labs(title = paste("md3")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30)) )+ guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots_mutant_genes[[5]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=9)) + labs(title = paste("md4")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots_mutant_genes[[6]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=9)) + labs(title = paste("md5")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots_mutant_genes[[7]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=9)) + labs(title = paste("fd1")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots_mutant_genes[[8]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=9)) + labs(title = paste("fd2")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots_mutant_genes[[9]] + coord_fixed() + theme_void() + theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=9)) + labs(title = paste("fd3")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
list_of_density_plots_mutant_genes[[10]] + coord_fixed() + theme_void()+ theme(plot.title = element_text(hjust = 0.5), legend.text = element_text(size = 8), text=element_text(size=9)) + labs(title = paste("fd4")) + scale_colour_gradientn(colours=c("#DCDCDC", plasma(30))) + guides(colour = guide_colourbar(barwidth = 0.5, barheight = 4.5, title = "")),
labels = c(toupper(letters)[2:17]),
label_size = 12,
nrow = 4)
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Scale for 'colour' is already present. Adding another scale for 'colour', which will replace the existing scale.
Figure_publication <- plot_grid(umap_id_pt,
mutant_genes_figure,
## add empty plot to give spacing
ggplot() + theme_void(),
labels = c('A'),
label_size = 12,
ncol = 2,
nrow=2,
rel_heights = c(1, 1, 4),
rel_widths = c(1, 2, 3))
Figure_publication
save
ggsave("../images_to_export/Figure_C.png", plot = Figure_publication, device = "png", path = NULL, scale = 1, width = 21, height = 29.7, units = "cm", dpi = 300, limitsize = TRUE)